Skip to content

Fix silent loss of changes in enum-only diagrams - #1186

Merged
1ilit merged 1 commit into
drawdb-io:mainfrom
Thedan-1:fix/autosave-enum-only-diagrams
Oct 31, 2026
Merged

1ilit merged 1 commit into
drawdb-io:mainfrom
Thedan-1:fix/autosave-enum-only-diagrams

Conversation

@Thedan-1

Copy link
Copy Markdown
Contributor

I ran into silent loss of enum changes while testing a PostgreSQL schema revision locally on dc32c8b (Windows, Node 22.14.0, Chromium-based in-app browser, Chinese UI).

The workflow was: create an orders table, let it save, use Save as to make orders-v2-test, open that copy, remove its table, then define order_status with the value pending. Save as itself worked and the original diagram remained intact. The problem started when the copy contained only enums: the header still said “No changes”, and refreshing removed the enum.

The same guard causes the reverse problem: load a saved enum-only diagram, delete its last enum, and refresh. The UI says the enum was deleted, but it returns after reload.

This patch counts enums when deciding whether there is content to autosave and watches their count. It also lets edits recorded in undo/redo history save an empty diagram, so deleting the last object or undoing its creation persists. A fresh, untouched empty canvas still does not trigger autosave.

Local verification

  • Before: created enum disappeared on reload; deleted last enum returned on reload.
  • After: enum name and value survived reload; deleting the last enum survived reload; creating an enum and undoing it left the diagram empty after reload.
  • Reopened the original orders diagram: its table remained intact.
  • npm run lint and npm run build passed. Build emitted bundle-size and third-party dependency warnings.

These are actual browser checks against the running application, not mocked UI or automated unit tests. Screenshots are stored on a separate branch of my fork and are not part of the code diff.

Evidence

Enum entered, but header still shows no changes:
Enum before reload

Original code after reload — enum is gone:
Enum lost

Patched code after reload — name and value remain:
Enum retained

Additional deletion-before/after screenshots.

@vercel

vercel Bot commented Oct 31, 2026

Copy link
Copy Markdown

@Thedan-1 is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
drawdb Ready Ready Preview Oct 31, 2026 3:02pm UTC

@1ilit 1ilit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch, thank you!

@1ilit
1ilit merged commit a249c7f into drawdb-io:main Oct 31, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — a1ce875b Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants