forked from vanife/BetSwirl--sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
When selecting a freebet that requires a chain switch, there's a race condition where the freebet and token are set immediately while the chain switch is still pending. This causes a brief inconsistent state where:
- The selected freebet is from Chain B
- The app is still on Chain A
- The token displayed may be incorrect
Steps to Reproduce
- Connect wallet on Chain A (e.g., Polygon)
- Have freebets available on both Chain A and Chain B (e.g., Base)
- Select a freebet from Chain B
- Observe that the freebet/token are set before the chain actually switches
Expected Behavior
- Chain should switch first
- Only after successful chain switch should the freebet and token be selected
- No intermediate inconsistent state should be visible
Current Behavior
- Freebet and token are set immediately
- Chain switch happens asynchronously afterward
- Brief period where selected freebet doesn't match current chain
Impact
- Confusing UX during chain switches
- Potential for incorrect token display
- May cause issues with bet placement if user acts during the inconsistent state
Reactions are currently unavailable