Repository navigation
Ask before closing a Workspace tab with unsaved edits #342
Description
Closing a file tab in the Workspace panel throws away edits that are not saved yet (typing from the last moment before autosave, or anything left after a failed save) without asking.
Where to start
- closeWorkpiece removes the tab without reading the dirty state the panel already tracks (workspaceDirtyRef), and the editor's autosave timer is cleared when the editor unmounts.
- When the tab has unsaved edits, save first or ask Save / Discard before closing.
- Pull the close decision into a small pure function and test it.
Code to look at:
frontend/components/chat/session-view.tsx:595frontend/components/chat/workspace-pane.tsx:107frontend/app/(library)/agent/artifacts/[id]/artifact-editor-state.ts:418
Done when
- Closing a tab with unsaved edits saves them or asks first.
- Closing a clean tab still closes at once.
- A unit test covers dirty and clean closes.
Free to try
Sign up free at app.useagent.org. New accounts get free model credits (GLM or Claude Opus, up to a limit) and free cloud sandbox time, enough to finish this task without paying or adding a key.
Send it a small task in plain words and watch it work. You'll see the screens this issue is about. The link in the sign-up email works for 24 hours. Not there? Check spam.
Stuck? Comment here with a screenshot and we'll help.
Keep private details out of here
This page is public. Don't post your real email, phone number, address, payment details, API keys, or screenshots that show any of them. Send anything private, including how you'd like to be paid, to [email protected] with a link to your comment here.
Claim it
Comment /take and the issue is assigned to you. First come, first served.
Rules
- Use the app while you work, and put before and after screenshots or a short recording in your pull request. For backend or docs work, show the result end to end.
- One change per pull request. Run the checks in CONTRIBUTING.md.
- AI help is fine, blind AI output is not. You must understand, run and explain every line you submit.
- Untested or generated pull requests, and pull requests on an issue someone else claimed, are closed without a reply and don't count for Hacktoberfest.
Activity
sharmis-tp commentedon Oct 21, 2026
I'd like to take this one. I'd have
closeWorkpieceread the dirty state already tracked inworkspaceDirtyRefand save first or ask Save / Discard before closing, with the close decision pulled into a small pure function and unit tests for dirty, clean and failed-save tabs. When a tab has unsaved edits, would you prefer a silent save first or always asking Save / Discard?