Summary
The optimistic buy update modifies the React Query cache immediately on submission. If the transaction fails, the cache must be rolled back to the exact state before the optimistic write. Unit tests should confirm the rollback restores the previous holding quantity without leaving the cache in a partially updated state.
Scope
- Seed the React Query cache with a holding of 2 keys for a creator
- Trigger a buy for 1 key and apply the optimistic update (cache should show 3)
- Simulate a transaction failure
- Assert the cache is rolled back to 2 keys, not 3
- Assert a second optimistic update after the rollback starts from the correct base of 2
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram
Summary
The optimistic buy update modifies the React Query cache immediately on submission. If the transaction fails, the cache must be rolled back to the exact state before the optimistic write. Unit tests should confirm the rollback restores the previous holding quantity without leaving the cache in a partially updated state.
Scope
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram