Skip to content

fix(sql): track query text modifications in SqlQueryTabSession to prevent unsaved data loss on tab/app close - #936

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
issue/910-sql-tab-unsaved-text
Sep 24, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
issue/910-sql-tab-unsaved-text

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Fixes #910

Summary of Changes:

  • Session tracking: Track _savedSql and isModified in SqlQueryTabSession to detect when SQL text has been edited from its disk-backed or initial state.
  • Dirty calculation: Make isDirty return true if stagingBuffer is dirty, if an unsaved draft tab has query text, or if a disk-backed tab has modified text.
  • Save lifecycle: Add markSaved({String? newFilePath}) method and call it on file open and file save across PostgreSQL, MySQL, SQLite, and Extension SQL workspaces.
  • Unsaved guards: Check session.isDirty on tab close and warn the user with a tailored message if uncommitted query text or staging data exists.
  • App close protection: UnsavedWorkRegistry automatically queries session.isDirty, preventing application exit while draft queries or edits exist.
  • Tests: Added comprehensive unit tests in test/features/workspace/multi_tab_sql_workspace_test.dart.

…vent unsaved data loss on tab/app close (Closes #910)
@github-actions github-actions Bot added bug Something isn't working editor Code/SQL editor labels Sep 24, 2026
@github-actions github-actions Bot added this to the 0.4.18 milestone Sep 24, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 92068be into dev Sep 24, 2026
4 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/910-sql-tab-unsaved-text branch September 24, 2026 05:42

@ZhuchkaTriplesix ZhuchkaTriplesix left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working editor Code/SQL editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant