mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## What Adds an opt-out for the "Unsaved changes" dialog shown when closing SQL editor tabs in manual-save mode. Resolves FE-4170. - New **Confirm on discard** toggle in the SQL editor's More actions menu (both toolbar layouts). - New **Don't ask again** checkbox in the dialog itself. It turns the same setting off when the user confirms the discard. - `DiscardChangesConfirmationDialog` gains a `children` slot. The description now renders as a `div` so block-level children are valid HTML. - `TabCloseConfirmation` gains an optional `optOut`, so any tab type can offer a "don't ask again" checkbox. Only SQL tabs use it. The Explorer tabs are unchanged. - The Intellisense and Confirm on discard items now use `DropdownMenuCheckboxItem`, so both settings announce their checked state to screen readers. The check indicator is still shown on the right via a local class override. <img width="353" height="229" alt="Screenshot 2026-10-20 at 16 10 14" src="https://github.com/user-attachments/assets/c6f67934-51ba-48dd-8aee-f279ae7eb486" /> <img width="432" height="207" alt="Screenshot 2026-10-20 at 16 10 02" src="https://github.com/user-attachments/assets/d064dcb1-1097-4ac3-bbf0-6a47506820c1" /> ## Behavior notes - The setting is stored in `localStorage` (`sql-editor-confirm-unsaved-changes`). It is device-local and global, not per project. It defaults to on. - With the prompt off, closing a tab still **discards** its unsaved edits. It only skips the confirmation. - It only applies in manual-save mode. In auto-save mode there is nothing to discard, so the toggle is hidden. - The browser's native `beforeunload` prompt, shown when closing or reloading the browser tab with unsaved work, is unaffected. Browsers don't allow customizing it. ## Testing - New unit tests for the SQL tab close handler: it confirms by default, skips the dialog when the setting is off, and the opt-out writes the setting. - `lint:ratchet` and `knip` pass. - Manually checked the menu at both widths and the dialog.