~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A form that edits in place says it is changed, saving, saved, or why not

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:console/saving

What changes

Saving in place says what happened. The profile form and the who-sees-it form end in a new SaveBar: the Save button, and beside it a status line read out to screen readers. It says "Unsaved changes" once something is edited, "Saving…" while the save is on its way, "Saved" when the host has it, or why the host refused. A refusal stays until the form saves. Save is quiet while there is nothing to save and turns primary once there is. It is never disabled, so it can always be reached. Saving (#lib/saving.svelte.ts) tracks this by comparing what the form would send with what it held when last drawn or saved, so putting an edit back clears it.

Buttons hold while their form is sent. Every form sent in place (inPlace, inDialog, Saving) disables the button that sent it and marks it aria-busy until the answer comes back. A double click no longer sends twice.

Leaving with unsaved changes asks first. LeaveGuard, in the root layout, opens "Leave without saving?" when the reader follows a link or goes back while a form holds unsaved changes. When the tab is closed or reloaded, the browser asks in its own words.

The ui skill gains a Saving rule under "The same act, the same way". It also says that an act whose result shows on the page (a link added, a request approved) needs no more confirmation, and that the console uses no toasts.

Why

After the move to use:enhance, saving the profile changed nothing visible: the page was redrawn with the same values, with no message. This follows Primer's and GitLab's saving patterns:

  • an inline confirmation next to the Save button when the result is not otherwise visible;
  • no toasts, which show far from what was pressed and go before they are read;
  • a refusal that stays until it is fixed;
  • a Save button that is never disabled;
  • a warning before leaving unsaved changes.

The leave dialog's quiet button is "Keep editing", not "Cancel", because "Cancel" there could also mean "throw the changes away".

How it was checked

  • e2e: the profile flow checks "Unsaved changes" and a primary Save, then "Saved" and a quiet Save. The visibility and open-join flows wait for "Saved" instead of the POST's response. A new flow checks the leave dialog: Keep editing keeps what was typed, putting the edit back clears the status, and Leave goes to Rules without saving. All 33 pass locally.
  • npm run check, harness/layers.mjs and harness/dialogs.mjs pass.
  • Drew clean, changed and saved, the leave dialog on desktop light and phone dark, and the visibility form changed, all with just look. A fresh agent critiqued the pictures against the house rules. Its fixes are in: shorter dialog wording, "Saved" no longer bold, and the skill now covers two changed forms on one page.

Shortcomings

  • The refused state was not drawn: the browser's own validation stops every bad value these two forms take before it is sent. It is the same status line in --danger.
  • With both forms on the settings page changed at once, two Saves are primary. The skill names this as the one exception.
  • Going back through history after "Leave" pushes a new entry rather than going back one.

🤖 Generated with Claude Code

changed-alice-desktop-light.png

saved-alice-phone-dark.png

leave-alice-desktop-light.png

leave-alice-phone-dark.png

Approved

This adds a Saving class and a SaveBar so the profile and visibility forms show "Unsaved changes", "Saving…", "Saved" or why not. It also holds the submit button while any in-place form is sent, adds a LeaveGuard dialog for unsaved changes, and adds a Saving rule to the ui skill. The change-tracking logic reads correctly. Putting an edit back clears the status. A refusal sticks until the form saves. The type === 'form' and leaving escapes in the guard are right. The e2e flows cover the new behaviour.

I couldn't run it or read the checks, so this is from reading the diff only. Two small things, neither blocking:

  • LeaveGuard cancels every non-form navigation while any form is unsaved. That includes a goto after a redirect result from a form action. Saving.submit doesn't mark the form saved before update follows a redirect, so a future redirecting action on a tracked form would trip the dialog. Neither current action redirects.
  • Two lines in the skill's Saving bullet (the "never disabled" line and the "Cancel there could mean…" line) run past the wrapped width of the rest. If oxfmt covers .claude, the format check may flag them.
Merged as 290de3e