feat(app): auto-save tile edits when closing the editor modal#2261
feat(app): auto-save tile edits when closing the editor modal#2261brone1323 wants to merge 2 commits into
Conversation
When the tile editor modal is closed with unsaved changes, the form is now saved automatically (via saveRef exposing handleSubmit(handleSave)) instead of prompting the user to discard changes. A toast notification confirms that edits were saved. Closes hyperdxio#1668
|
@brone1323 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
|
Deep ReviewThe auto-save-on-close flow has an async/sync mismatch in 🔴 P0/P1 -- must fix
🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (5): correctness, julik-frontend-races, kieran-typescript, testing, maintainability. Testing gaps:
|
PR Review
|
Summary
Closes #1668.
Currently, closing the tile editor with unsaved changes shows a "Discard" confirmation dialog. This PR implements auto-save on close instead, so edits are never accidentally lost.
Changes
EditTimeChartForm: Adds asaveRefprop (parallel to the existingsubmitRef) that the parent can hold to programmatically triggerhandleSubmit(handleSave)— the same validated-save path the Save button uses.EditTileModal: Drops theuseConfirmdiscard dialog. On close with unsaved changes, callssaveRef.current()and shows a green toast confirming the save. The Cancel button in the form still closes without saving, preserving an explicit escape hatch.Behaviour after this PR
handleSaveshows "Invalid Chart" error; modal stays openIf form validation fails,
handleSaveshows its own error notification and the save is skipped, keeping the modal open for the user to fix the issue.