Page properties: add Save & close button to the docheader #82
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle#82
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
The page-properties mode of the page docheader (
props=1) gains a second primary action: Save & close next to the existing Save. Save keeps the form open (save-and-keep-editing, useful with preview); Save & close saves and, on success, returns to page content (clearsprops). On a 422 validation error both buttons leave the form open with the existing inline field errors. The unsaved-changes guard on plain Close is unchanged.Key code:
web/src/components/PagePane.tsx(props-mode docheader,props-savebutton,SettingsSaveApiseam),web/src/components/PageSettings.tsx.Acceptance criteria
Blocked by
None - can start immediately
Triage addendum — verified against the codebase
Brief confirmed accurate; the change is smaller than it may look. Facts for the implementing agent:
SettingsSaveApi.save()(web/src/components/PageSettings.tsx~37–41) returnsPromise<boolean>—trueon successful save,falseon a 422 (result.kind === "fields"maps inline field errors) or client-side validation failure. Save & close is essentially:if (await settingsApi()?.save()) setSearchParams({ props: undefined }).props-saveinweb/src/components/PagePane.tsx(~1944–1952); Close isprops-close(~1937), which just drops thepropsparam. Disable the new button under the samebarSaveDisabled()condition.useBeforeLeaveinApp.tsx~245, form registered throughuseGuardinPageSettings.tsx~223). Save & close clears dirtiness before navigating (a successful save resetsfieldsBaseline), so the guard won't fire on the success path — no extra wiring needed. Close + dirty behavior stays untouched.web/src/test/Docheader.test.tsxdescribe("props mode")(~229–304, already covers save-stays-open and dirty-Close-guard) andweb/src/test/PageSettings.test.tsx(has the 422 inline-error fixture at ~152–168 to reuse for the stay-open path).