Skip to content

Fix stale board/invite hook state across auth transitions#68

Merged
OrF8 merged 2 commits intocodex/refresh-documentation-for-v1.1.0-release-4qe8wwfrom
codex/address-pr-comments-in-hooks
Apr 8, 2026
Merged

Fix stale board/invite hook state across auth transitions#68
OrF8 merged 2 commits intocodex/refresh-documentation-for-v1.1.0-release-4qe8wwfrom
codex/address-pr-comments-in-hooks

Conversation

@OrF8
Copy link
Copy Markdown
Owner

@OrF8 OrF8 commented Apr 8, 2026

Motivation

  • Prevent stale UI state (old invites, board lists, error banners, and retry indicators) from leaking across auth identity transitions (uid/email changes and sign-out/sign-in flows).
  • Ensure hooks show a clear loading/reload state instead of displaying another user’s previous failure or data snapshot while a new subscription is establishing.

Description

  • Reset subscription state in cleanup for useBoards so previous boards, error, retryingSecureConnection, and forUid are cleared when the subscription ends or the uid changes.
  • Reset subscription state in cleanup for useIncomingInvites so previous invites, error, and forEmail are cleared when the subscription ends or the email changes.
  • Suppress stale UI by gating returned error and retryingSecureConnection behind the hook loading state (error: loading ? null : state.error and retryingSecureConnection: loading ? false : state.retryingSecureConnection), and similarly suppress invite error while invite subscription is loading.
  • Preserve the unauthenticated return paths (when uid or email are falsy) to return empty lists and no error.
  • Resolved PR v1.1.0 release prep: docs, version bumps, hooks refactor, BoardPage fix #67 review comments by grouping fixes: comments 1 and 5 (stale invite/error for useIncomingInvites) and comments 2, 3, 4, and 6 (stale boards/error/retry for useBoards).

Testing

  • Ran npm run lint and fixed issues until the lint step completed successfully (final npm run lint passed).

Codex Task

@OrF8 OrF8 self-assigned this Apr 8, 2026
@OrF8 OrF8 added the enhancement New feature or request label Apr 8, 2026
@OrF8 OrF8 marked this pull request as ready for review April 8, 2026 18:40
Copilot AI review requested due to automatic review settings April 8, 2026 18:40
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useBoards subscription state (boards/error/retry/forUid) when the subscription ends.
  • Reset useIncomingInvites subscription state (invites/error/forEmail) when the subscription ends.
  • Gate returned error (and retryingSecureConnection in useBoards) behind loading to 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.

@OrF8 OrF8 merged commit faadc04 into codex/refresh-documentation-for-v1.1.0-release-4qe8ww Apr 8, 2026
3 checks passed
@OrF8 OrF8 deleted the codex/address-pr-comments-in-hooks branch April 8, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants