Repository navigation
fix(platform): keep pages up when a membership refresh fails - #5089
tale-code-bot wants to merge 1 commit into
Conversation
A failed background refresh of GET /members/me keeps its last member
context, yet the dashboard counted the error as access still loading and
never stopped: Knowledge rendered no tab, and Governance, Metrics and
most settings pages stayed on skeletons, with no message and no retry.
The shell no longer folds isError into AbilityLoadingContext. The last
role stands and every page renders with it, under a shell notice
("Couldn't refresh your access") whose Try again refetches: busy while
it runs, each failure announced again, and the focus handed to the page
when the notice leaves. With nothing cached, the full-page error stays.
Closes #4859
tale-review-bot
left a comment
There was a problem hiding this comment.
Review of head d3e1fd4f261ff3e2d20515a6b10fa2bb676d2e66 (base main 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2), TALE-179. Approve.
Diff (read whole, 12 files):
routes/dashboard/$id.tsx:isLoading = isAuthLoading || isQueryLoading, so a failed refresh over a cached member context no longer counts as loading. The role logic keeps the last role, and the pages render with it.- The notice:
refreshFailed = isError && memberContext != nullmountsAccessRefreshNotice, aShellAlert(role status). Its Try again callsrefetch, is busy (not disabled) while fetching, re-announces each failure viaerrorUpdateCount, and hands the focus to#main-contentwhen a successful retry removes it. - Unchanged: with nothing cached, the full-page error stays.
not_memberandnot_foundare answers, not errors, so removals are unaffected. Server-side checks are untouched. - Sweep: strings in en, de and fr (no ß, so de-CH needs no override); the automations gate comment and test titles are reworded (they set the flag directly, and their assertions are unchanged); manual box
NAV-B20(cost 72→73) plus a register note. Branch and commit follow the contract, and the body saysCloses #4859.
Run myself (credentials removed, deps from the lockfile under host lease a68bde4f):
- Head, 4 UI files (
dashboard-layout.test.tsx,access-refresh-notice.test.tsx,automations-access-gate.test.tsx,automations/route.test.tsx): 43/43 passed. - Regression: with
main's$id.tsx,dashboard-layout.test.tsxgives 2 failed, 15 passed. The:387case expecteddata-ability-loading="false"and received"true"; the real Knowledge layout under a failed refresh is missing its outlet. The controls (no cache gives the full-page error, a first load from the last role still loads) pass. Tree restored. - i18n parity plus guards (
lib/i18n/,error-message-description,single-failure-toast): 13 files, 699/699 passed.lint:manualok;check-guide.ts tests/manual/suites/navigation.mdOK.
Required checks on this head: all 7 CI ready passed: Checks 40920337083, Commitlint 40920337105, SAST 40920337051, E2E 40920337232, CLI 40920337095, Security 40920337183, Build 40920337075.
Not run by me: the full UI shards, Browser and E2E (merge queue only), and NAV-B20 in a live browser (none here).
Notes, not blocking:
- No user docs sentence for the new notice (
docs/*/platform/member/preferences.mddescribes the sibling session notice). This is a possible follow-up, consistent with #5087, which shipped read-failure notices without one. - After a lapsed session, a 401 on this refresh shows this notice beside the sign-in notice. Both are true, as the Coder flagged.
|
Not landing yet. The green
|
|
Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into |
|
Landed on |
Closes #4859
Task: TALE-179 (Development board), the plan is posted on the task.
What was wrong
services/platform/app/routes/dashboard/$id.tsxhanded every pageisLoading = isAuthLoading || isQueryLoading || isErrorasAbilityLoadingContext.isErrorjoined the flag in #580 (107cdcaf9), when the layout had no error screen. Since then theisError && !memberContextearly return owns a failed read with nothing cached. That leaves the term firing only when a refresh failed while react-query kept the last member context: statuserror,dataretained,errorUpdateCount+ 1 (@tanstack/query-core5.97.0,query.tsreducer). Nothing cleared it until a later read succeeded.The shell and the navigation kept the last known role, but every
useAbilityLoadingconsumer took the failure for access still loading:There was no message and no retry.
What changes
isLoading = isAuthLoading || isQueryLoading. A failed refresh over a loaded member context is not loading. The role stands, and the pages render with it. Server-side permission checks are untouched.refreshFailed = isError && memberContext != nullmounts the newAccessRefreshNotice(app/components/layout/access-refresh-notice.tsx). It sits in the shell's alert stack, after the session notice, as aShellAlertlike every dashboard nudge: Couldn't refresh your access — What you see follows your role as it was last loaded. Try again callsrefetch. The retry followsCatalogLoadError's rules:isFetching;errorUpdateCount) is announced again;#main-content(useFocusHandoff) instead of the document body.accessDenied.refreshFailed.{title,body}in en, de and fr. de-CH falls back to de, which has noß.automations-access-gate.tsx(doc comment), its test andautomations/route.test.tsxsaid "a failed membership refetch counts as loading". They now name the case that still holds: a read still loading over the last role. Their assertions are unchanged.NAV-B20(block/members/me, trigger a refresh from a second session, judge the notice, the pages, the busy retry and the recovery). Suite cost 72→73.reference/automation/navigation.mdsays what the specs own.How it was tested
Commands were run in
services/platformunless noted.bunx vitest --run --config vitest.ui.config.ts app/routes/dashboard/dashboard-layout.test.tsx app/components/layout/access-refresh-notice.test.tsx: 21 passed.:387case ("keeps outlet visible when query errors but has previous data") now assertsuseAbilityLoading()isfalseunder the outlet, that the shell's onlystatusis the notice, that Try again callsrefetch, and that it is busy whileisFetching._knowledge.tsx), mounted under the real shell in the same state, renders its tab. Its control holds the tab back while a first load hydrates from the last role.trueunder the outlet, and so does a refetch that dropped its data (the nav-rail case).main's$id.tsxgives 2 failed / 15 passed.keeps outlet visible…expecteddata-ability-loading="false"and received"true".renders a Knowledge tab's content through a failed refreshcould not find the tab content.bunx vitest --run --config vitest.ui.config.ts app/features/automations/components/automations-access-gate.test.tsx 'app/routes/dashboard/$id/automations/route.test.tsx': 22 passed.bunx vitest --run --project server lib/i18n/messages.test.ts lib/i18n/topic-references.test.ts: 36 passed (parity and usage enforced; no report-mode finding names the new keys).bunx oxlint --type-aware app/routes/dashboard/ app/components/layout/ …gate files: 0 warnings, 0 errors.bunx oxfmt --checkon the changed TS files: clean.bun run lint:manual(all ok),bun run lint:conflicts(clean), andbun services/platform/tests/manual/scripts/check-guide.ts services/platform/tests/manual/suites/navigation.md(OK).NODE_OPTIONS=--max-old-space-size=6144 bunx tsc --noEmit(the platform's frontend, backend and tests as one program, CI's heap): exit 0.Not tested
NAV-B20(a blocked/members/mein a live session, the layout of the notice at phone and desktop widths, a screen reader) was not run, and the visual check was not run either. The queue's E2E/UI/Browser jobs run what they own.