Skip to content

fix(auth): invalidations on login#2107

Merged
synoet merged 3 commits intomainfrom
synoet/fix-login-invalidations
Mar 24, 2026
Merged

fix(auth): invalidations on login#2107
synoet merged 3 commits intomainfrom
synoet/fix-login-invalidations

Conversation

@synoet
Copy link
Copy Markdown
Contributor

@synoet synoet commented Mar 23, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Walkthrough

This pull request restructures authentication cache invalidation and user-info query gating. It introduces a new user-info-gate module that manages when user-info queries should execute, replacing local state management in the user context. The post-authentication flow across multiple login components is updated to call invalidateAllAfterLogin() instead of invalidateUserInfo(), which now invalidates all queries rather than just user-info data. The invalidateUserInfo() function is converted from async to synchronous, always enabling the user-info query and invalidating it unconditionally. These changes centralize query-gate logic and broaden cache invalidation scope after successful authentication.

Poem

🐰 A cache-clearing leap so spry,
Invalidate all, reach for the sky!
Gate-keeping signals, organized and neat,
Post-login refreshes make logic complete—
Hopping through queries with synchronized grace ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate whether it relates to the changeset. Add a description explaining the purpose and impact of the cache invalidation changes, including why invalidateAllAfterLogin is preferred over the previous approach.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: replacing invalidation calls with a new cache invalidation strategy after login authentication.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch synoet/fix-login-invalidations

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

@synoet synoet marked this pull request as ready for review March 23, 2026 14:58
@synoet synoet requested a review from a team as a code owner March 23, 2026 14:58
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@js/app/packages/app/component/auth/Login.tsx`:
- Around line 63-68: The .then callback on authServiceClient.sessionLogin calls
invalidateAllAfterLogin() but does not return or await its Promise, so
downstream code won't wait for cache invalidation; update the sessionLogin
handling to chain the invalidation Promise (e.g., return
invalidateAllAfterLogin() from the .then callback) or convert the flow to
async/await where you await authServiceClient.sessionLogin(...) and then await
invalidateAllAfterLogin() after verifying isOk(res) so the
invalidateAllAfterLogin Promise is properly sequenced.

In `@js/app/packages/app/component/auth/LoginOptions.tsx`:
- Around line 89-91: The call to invalidateAllAfterLogin() is not awaited inside
the isOk(res) branch, causing possible race conditions; update the isOk(res)
branch in LoginOptions.tsx to await invalidateAllAfterLogin() (and optionally
wrap it in try/catch to log or handle errors) so query invalidation/refetching
completes before subsequent navigation or UI updates. Ensure you modify the
block containing isOk(res) to use await invalidateAllAfterLogin() and handle any
Promise rejection from invalidateAllAfterLogin().

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7b03af2c-97c9-4ee6-bf6e-895400ed964e

📥 Commits

Reviewing files that changed from the base of the PR and between 6eaadb6 and 755222c.

📒 Files selected for processing (7)
  • js/app/packages/app/component/EmailAuth.tsx
  • js/app/packages/app/component/auth/Login.tsx
  • js/app/packages/app/component/auth/LoginOptions.tsx
  • js/app/packages/core/context/user-info-gate.ts
  • js/app/packages/core/context/user.ts
  • js/app/packages/queries/auth/index.ts
  • js/app/packages/queries/auth/user-info.ts

@whutchinson98
Copy link
Copy Markdown
Member

macro-cyksuQgPDK6pLRiJaPtnZ-github-fix-testing -- ignore this is a test

@ghost
Copy link
Copy Markdown

ghost commented Mar 23, 2026

GITHUB FIX TESTING

@synoet synoet merged commit 97f3403 into main Mar 24, 2026
46 checks passed
@synoet synoet deleted the synoet/fix-login-invalidations branch March 24, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants