fix(12-07): make ['me'] fresh on shell entry so post-wizard banner clears (gap 6)
- Root cause confirmed = mechanism (ii): ['me'] staleness, NOT a backend linking gap (upsertUser claim preserves users.id → credential stays linked → DB needsProviderSetup=false) - SetupBanner ['me'] query staleTime 5min → 0 so a pre-claim stale cache entry is refetched on mount; banner hides once needsProviderSetup resolves false - App.tsx boot ['me'] staleTime also set to 0 (committed with Task 1) for the same reason - Add SetupBanner.test.tsx regression: absent when false, present (no dismiss) when true, stale-cache refetch hides banner; success-only dismissal contract preserved (no X button) - Log pre-existing PWA lint errors (SetupPage.test.tsx, setupClient.contract.test.ts) to deferred-items.md
This commit is contained in:
@@ -33,11 +33,18 @@ export function SetupBanner() {
|
||||
// Use HTMLButtonElement for the ref (assignable to the CredentialSheet's HTMLElement trigger)
|
||||
const ctaRef = useRef<HTMLButtonElement>(null);
|
||||
|
||||
// staleTime 0 (gap 6): this banner gates on needsProviderSetup, which is only
|
||||
// correct if ['me'] is fresh on entry to the authenticated shell after the
|
||||
// wizard claim (see App.tsx for the full mechanism note). With a 5-minute
|
||||
// staleTime a pre-claim cache entry kept needsProviderSetup=true and the banner
|
||||
// showed even though the operator already configured the calendar in the wizard.
|
||||
// The success-only dismissal contract is unchanged: this banner still clears
|
||||
// ONLY when needsProviderSetup becomes false (no dismiss/X button).
|
||||
const meQuery = useQuery({
|
||||
queryKey: ['me'],
|
||||
queryFn: fetchMe,
|
||||
retry: false,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
staleTime: 0,
|
||||
});
|
||||
|
||||
// Only show when needsProviderSetup is explicitly true
|
||||
|
||||
Reference in New Issue
Block a user