Repository navigation
fix(app-shell): a record form opened on the app-name address stays in the app after save - #28066
Merged
Merged
Conversation
… the app after save RecordFormPage went Back when location.key was not 'default', but the console's canonical-pathname replace mints a key on the entry the document loaded on, so Save on an app-name address left the app. Read react-router's own entry index (history.state.idx) instead: 0 on the load entry, unchanged by a replace, one more per push. Claude-Session: https://claude.ai/code/session_01Utp6CZxX4vFUoXs7HyvMsp Co-authored-by: Claude <noreply@anthropic.com>
… spec Claude-Session: https://claude.ai/code/session_01Utp6CZxX4vFUoXs7HyvMsp Co-authored-by: Claude <noreply@anthropic.com>
…place through buttons Claude-Session: https://claude.ai/code/session_01Utp6CZxX4vFUoXs7HyvMsp Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe 席位核对ACCEPT · head
Generated by Claude Code |
This was referenced Oct 30, 2026
[Decision] wave-3 checklist: five held items need a ruling before their ledger edits (#27377)
#28345
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Bill · project thread
Fixes #28036
Clause-②: no
Metadata-protocol: none
维护者速读
history.state.idx):只有控制台自己推入过页面(序号大于 0)才后退,否则编辑落到记录页、新建落到列表页,都在应用内。/apps/showcase_app/...)打开表单时,控制台加载时会用一次"替换"把地址换成包 id 地址,这次替换给条目生成了新 key,旧判断(key 不是default就后退)误以为身后有应用内页面,保存后后退出了应用、提示也丢了。替换不改序号,推入才加一,所以序号能分清这两种情况。RecordFormPage的goBack一处判断,不碰AppContent.tsx的重定向。从列表、视图、记录页进入表单的路径仍然后退(单测与实栈对照都测了)。回滚 = revert 本 PR。ui/packages/app-shell/src/views/RecordFormPage.tsx的goBack;RecordFormPage.aliasAddressReturn-28036.test.tsx;ui/e2e/live/record-form-direct-url.spec.ts的新循环。Live E2E UI检查日志,Run the live e2e specs里record-form-direct-url.spec.ts应有两条通过:package id 与 app name 各一条。What changes
RecordFormPage'sgoBack(@object-ui/app-shell). It went Back whenlocation.key !== 'default'. The console's canonical-app-pathname effect replaces an app-NAME address with the package-id one on load, and thatreplacegives the entry a generated key with nothing of the console's behind it, so Save and Cancel rannavigate(-1)out of the document (console: a full-page record form opened by direct URL saves silently and then leaves the app for /_console/home #27454's fix held only on the package-id address). The page now reads react-router's own entry index,history.state.idx, at the moment of the click: react-router writes 0 on the entry the document loaded on, keeps it on a replace and adds one per push. Back only when it is a number above 0; otherwise the record detail (edit) or the object list (create), inside the app, as before.useLocationis no longer needed by the page and is dropped. Why the index rather than a console-writtenlocation.stateflag: the index is already written by every push the console makes, through any component, and kept by every replace, so nothing else in the console has to remember to mark its navigations; a flag would need every pushing call site to set it.RecordFormPage.aliasAddressReturn-28036.test.tsxloads the form on an app-name address underBrowserRouteron jsdom's real history, replays the console's canonicalreplaceto the package-id address, and asserts edit Save lands on the record detail with one toast, create Save lands on the list with one toast, edit Cancel lands on the record detail with no toast, and the control: a form PUSHED from a view page, then canonicalised, goes Back to that view. Each cell also asserts the replace minted a non-defaultkey, the condition the old test misread.RecordFormPage.directUrlReturn-27454.test.tsxkeeps its five cells and assertions; its harness moves fromMemoryRoutertoBrowserRouterwith a real react-router push, because the page now reads the browser history's entry index, which a memory router does not write.ui/e2e/live/record-form-direct-url.spec.tsnow runs its edit case on both addresses (com.example.showcaseandshowcase_app); the landing assertion is the package-id record path for both. Its header says why both..changeset/28036-record-form-app-name-address.md,@object-ui/app-shellpatch.Tests
pnpm exec vitest run packages/app-shell/src/views/RecordFormPage(fromui/): 11 files, 65 tests passed (head71c89ea2).scripts/ablation-replace.mjs(anchor hit 1 to 0, blob4cf71998toe207c822, restored to the HEAD blob,git diff HEADempty):goBack's condition put back to the old key test (history.state.keynotdefault). Direction written before the run: the three app-name cells RED, the in-app control GREEN, the five console: a full-page record form opened by direct URL saves silently and then leaves the app for /_console/home #27454 cells GREEN. Observed: exactly that, 3 failed / 6 passed of 9. Run on93e6b790and again on71c89ea2.pnpm --filter @object-ui/app-shell type-check(bothtscprograms, the test one included): exit 0 on71c89ea2.pnpm --dir ui run type-check:e2e: exit 0. eslint on the four changed files: 0 errors; the 17 warnings are in lines ofRecordFormPage.tsxthis diff does not touch.Acceptance notes
The card's table, re-measured on this branch (head
1de7cdda; the later commit changes only the jsdom test harness), with theLive E2E UIjob's build (its turbo filters plusVITE_BASE_PATH=/ vite build),start-backend.shandvite preview, one fresh Playwright page per row:history.stateafter loadshowcase_app(app name)idx0showcase_app(app name)idx0com.example.showcase(package id)idx0com.example.showcase(package id)idx0com.example.showcase, control: pushed from the listidx1The app-name rows read
about:blankand 0 toasts on test(ui): pin the direct-URL record form save and nav CEL visibility in Live E2E UI #28034's stack before this change (the card's table). The new rows came from a throwaway Playwright file, not committed. The control row's push was written the way react-router's own push writes it (pushStatewithidx+ 1, then thepopstateits listener reads), because no showcase object declareseditMode: 'page', so the console's Edit and New open the modal form and no in-app control there pushes the full-page form; the jsdom control drives a real react-router push.pnpm --dir ui run test:e2e:live:ci --retries 0on the same stack: 16 passed (1.5 min on a shared box), the 15 before plus the new app-name case.Not changed, noted:
FormPage.tsxinui/apps/consolereadslocation.key !== 'default'for its Cancel, the same test this PR replaces; whether a canonical replace reaches its routes was not measured, and it is outside this card's file surface.PageHeaderinui/packages/layoutstill readswindow.history.length > 1for its back button.console/AppContent.tsxis untouched (seat 4's open PR perf(console): opening a record re-reads no list, asks its field access once, and the bell polls once a minute #27907 holds it).The project attribution link in the first two lines names the seat's thread, as the order requires.
Verification
Derived gates (
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack), every command run with its exit code recorded before any pipe, reconciled with--ran: 34 derived, 34 run, 0 NOT-MEASURED.34 derived gates, plus three outside the derivation
All gate readings on head
71c89ea2.Generated by Claude Code