Repository navigation
Commit d17f670
fix(console): settings pages re-read their namespace after a save or action (objectui#13382) (#13415)
Closes #13382
Clause-②: no
## What changed
`SettingsView` (`apps/console/src/pages/settings/SettingsView.tsx`) now
reads its namespace again after a successful save or action, through the
same `getSettingsNamespace` the load effect uses, and takes the whole
payload, manifest included. After objectstack#25448 the server puts a
live-status `info_banner` (id `live_status`) first in
`manifest.specifiers` on every read, so Setup → Email's banner now
follows a save without a reload.
- **Save:** the PUT's values are still merged and the draft, field-error
and crypto-refusal resets are unchanged. The success toast fires, then
the re-read runs.
- **Action:** the re-read runs only when the action answers `ok`. The
draft is left as it is.
- **Re-read fails:** it is caught and ignored, so the merged values and
the success toast stay and the page does not turn into an error.
- **No placeholder flash:** `loading` is not flipped.
- **Stale guard:** the load effect has no cancellation of its own, so a
read counter (`readSeqRef`) is added. The load effect bumps it, and each
re-read applies only while it is still the latest. A re-read that lands
after a namespace change, or after a newer re-read, is dropped.
## Tests
- New `SettingsView.rereadAfterSave-13382.test.tsx`: a fake `fetch`
whose first GET answers "No mail leaves this machine" and every later
GET answers "Mail is delivered through SMTP (…)". Six cases:
- control: the first load is unchanged and sends one GET;
- after a save the new banner shows, with no remount (the same
field-list node) and the saved value and toast present;
- after a successful action the new banner shows;
- an unsaved draft survives an action and its re-read;
- a save whose re-read rejects still shows the saved value and the
success toast, with no error toast and no load-failure card;
- a re-read held in flight and released after a move to another
namespace is dropped.
- **Ablation:** with the `SettingsView.tsx` change reverted, 4 of the 6
cases fail and the control passes. The namespace-change case passes
there because nothing re-reads. With only the load effect's counter bump
removed, that case fails and the other 5 pass.
- **Sibling fakes:** two existing fakes answered every GET with a fixed
fixture while their PUT answered other values, a server that contradicts
itself. The re-read exposed that.
- `SettingsView.unsetAndReset-13145` and
`SettingsView.languageKeepsDraft-13254`: each fake now stores what its
PUT wrote, and later GETs return it.
- The 13254 case "after a language change, Save sends the kept edit and
the bar goes" still asserts that the language change sent no GET. After
the save it now expects the one re-read, so it is a second pin for this
fix: it fails with the fix reverted.
- `pnpm exec vitest run apps/console/src/pages/settings/
--maxWorkers=2`: 29 files and 239 tests passed, at `5ee1459d6d`.
- `turbo run type-check --filter=@object-ui/console...`: 71/71
successful. The console's `tsconfig.json` includes `src`, so the tests
are type-checked too.
- `eslint` on the four touched files: 0 errors and 3 `no-explicit-any`
warnings, all on existing `catch (err: any)` lines. With
`--no-inline-config` there is 1 error, `react-hooks/static-components`
on the existing `getLazyIcon` line, whose inline disable that flag
ignores. `origin/main`'s copy of the file gives the same error, so it is
not new here.
- `node scripts/check-changeset-presence.mjs` ✅,
`check-changeset-no-major` ✅, `pnpm check:new-line-citations`: 0 new.
## Changeset
`.changeset/13382-settings-reread-after-save.md`, a `@object-ui/console`
patch.
## Acceptance notes
- The load effect itself still has no stale guard: if namespace A's
first GET resolves after a move to B, it could still land. This PR does
not change that path (the card's control is "first load unchanged"), and
it was not reproduced here.
- I have not checked this in a running console against
objectstack#25448. The pins drive the page over a stubbed `fetch`.
- [x] Adds no product-specific widget, dialog, hook or string (see
AGENTS.md › Product-neutral renderer)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WJozybDmRH8z2c5SD7vJkj
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4b1ddf3 commit d17f670
5 files changed
Lines changed: 358 additions & 8 deletions
File tree
- .changeset
- apps/console/src/pages/settings
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
278 | 285 | | |
279 | 286 | | |
280 | 287 | | |
| |||
301 | 308 | | |
302 | 309 | | |
303 | 310 | | |
| 311 | + | |
| 312 | + | |
304 | 313 | | |
305 | 314 | | |
306 | 315 | | |
| |||
382 | 391 | | |
383 | 392 | | |
384 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
385 | 417 | | |
386 | 418 | | |
387 | 419 | | |
| |||
425 | 457 | | |
426 | 458 | | |
427 | 459 | | |
| 460 | + | |
428 | 461 | | |
429 | 462 | | |
430 | 463 | | |
| |||
501 | 534 | | |
502 | 535 | | |
503 | 536 | | |
504 | | - | |
505 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
506 | 544 | | |
507 | 545 | | |
508 | 546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| 82 | + | |
77 | 83 | | |
78 | 84 | | |
79 | | - | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| |||
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| 224 | + | |
| 225 | + | |
218 | 226 | | |
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
222 | 230 | | |
| 231 | + | |
| 232 | + | |
223 | 233 | | |
224 | | - | |
225 | 234 | | |
226 | 235 | | |
227 | 236 | | |
| |||
0 commit comments