-
Notifications
You must be signed in to change notification settings - Fork 0
[US-17.1 / OBT-254] fix(auth): commit session state atomically to stop Access Denied flash #38
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ interface PhasesStore { | |
| lastFetched: number | null | ||
| fetch: () => Promise<void> | ||
| invalidate: () => void | ||
| reset: () => void | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Same issue as Also applies to: 50-53 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| const CACHE_TTL = 2 * 60 * 1000 // 2 minutes | ||
|
|
@@ -46,4 +47,8 @@ export const usePhasesStore = create<PhasesStore>((set, get) => ({ | |
| invalidate: () => { | ||
| set({ lastFetched: null }) | ||
| }, | ||
|
|
||
| reset: () => { | ||
| set({ phases: [], dependencies: new Map(), loading: false, lastFetched: null }) | ||
| }, | ||
| })) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
reset()doesn't guard against an in-flightfetch()clobbering the reset state.If
reset()(called fromlogout()) runs while afetch()is mid-flight, the pending call's.thenstill unconditionally commits{ languages: data, lastFetched: Date.now(), loading: false }once it resolves — overwriting the just-reset store with data fetched under the previous session/account. Any caller queued on the "duplicate fetch" subscriber (Lines 30-37) also resolves early with the emptiedlanguagesarray instead of the real result.♻️ Proposed fix using a generation counter
Also applies to: 54-57
🤖 Prompt for AI Agents