Fix stale board/invite hook state across auth transitions#68
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b37602f41d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent stale boards/invites data, errors, and retry indicators from leaking across authentication identity transitions by resetting subscription state and gating returned values during (re)subscription loading.
Changes:
- Reset
useBoardssubscription state (boards/error/retry/forUid) when the subscription ends. - Reset
useIncomingInvitessubscription state (invites/error/forEmail) when the subscription ends. - Gate returned
error(andretryingSecureConnectioninuseBoards) behindloadingto suppress stale UI while a new subscription establishes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/hooks/useIncomingInvites.js | Adds cleanup-time state reset and hides error while loading to avoid leaking invite/error state across auth transitions. |
| src/hooks/useBoards.js | Adds cleanup-time state reset and hides error/retry while loading to avoid leaking board/error/retry state across auth transitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
faadc04
into
codex/refresh-documentation-for-v1.1.0-release-4qe8ww
Motivation
Description
useBoardsso previousboards,error,retryingSecureConnection, andforUidare cleared when the subscription ends or the uid changes.useIncomingInvitesso previousinvites,error, andforEmailare cleared when the subscription ends or the email changes.errorandretryingSecureConnectionbehind the hookloadingstate (error: loading ? null : state.errorandretryingSecureConnection: loading ? false : state.retryingSecureConnection), and similarly suppress inviteerrorwhile invite subscription is loading.uidoremailare falsy) to return empty lists and no error.useIncomingInvites) and comments 2, 3, 4, and 6 (stale boards/error/retry foruseBoards).Testing
npm run lintand fixed issues until the lint step completed successfully (finalnpm run lintpassed).Codex Task