8000 fix(ui): prevent AddPoolModal closing during pool creation by drichar · Pull Request #356 · algorandfoundation/reti · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(ui): prevent AddPoolModal closing during pool creation #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

drichar
Copy link
Collaborator
@drichar drichar commented Feb 4, 2025

Description

This PR fixes an issue where the add pool modal would close prematurely when queries attempted to fetch stakers data before the pool's box storage was initialized. The fix required refactoring state management to better coordinate query timing and modal lifecycle.

Details

  • Pause staking data queries while pool creation is in progress
  • Lift pool state to ValidatorDetails to avoid duplicate modals
  • Extract pool selection into dedicated SelectPool component
  • Add coordinated query refetching via refetchAll function
  • Add onClose callback to AddPoolModal to trigger staking data queries refetch
  • Update empty state message in pool chart

Improve handling of pool creation flow by pausing query refetches until the
pool's box storage is initialized. Previously, the modal would close
prematurely when queries attempted to fetch stakers data from the pool's box
storage before the box was created in step 2.

- Add `onClose` callback to `AddPoolModal` to communicate success/failure state
- Pause staking data queries while pool creation is in progress
- Move query invalidation to `StakingDetails` component
- Add `refetchAll` function to `useStakersChartData` for coordinated refetching
- Update empty state message in pie chart to be more descriptive
- Consider pool creation successful after MBR payment (step 2)

The `onClose` handler is optional as this fix is specific to adding pools from
the `StakingDetails` component where stakers data is refetched every 30 seconds.
Adding pools from the dashboard does not require this handling.
Copy link
vercel bot commented Feb 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
reti ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 4, 2025 6:05pm

Move pool-related state and logic from `StakingDetails` to `ValidatorDetails`
component to avoid duplicate `AddPoolModal` instances. Extract pool selection
logic into `SelectPool` component.

- Delete `StakingDetails` component and move its logic to `ValidatorDetails`
- Extract pool selection logic into `SelectPool` component
- Move `AddPoolModal` state and `canAddPool` logic to `ValidatorDetails`
- Pass pool-related props from `ValidatorDetails` to `Highlights`
- Add `StakerChartData` interface
@drichar drichar changed the title fix(ui): prevent modal closing during pool creation fix(ui): prevent AddPoolModal closing during pool creation Feb 4, 2025
@drichar drichar marked this pull request as ready for review February 4, 2025 19:17
@drichar drichar merged commit 449c950 into dev Feb 4, 2025
4 checks passed
@drichar drichar deleted the fix/ui-add-pool-flow branch February 4, 2025 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0