Add confirmation dialog when clicking "New" if model is dirty

Open
#580 0 comments 0 reactions 0 assignees View on GitHub

@nachodiezgarcia is already working on this.

Since Jun 11, 2026.

  • #613 by @nachodiezgarcia — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript

Research direction

Start at the toolbar's "New" action and compare its behavior with the existing confirmation dialogs referenced by issue #78. Verify the dirty-state condition, cancel and confirm outcomes, the stated message, and the alertdialog accessibility requirements; done means unsaved work is protected while clean models still open directly.

Written by the indexing model from the issue text.

Description

Currently, when a user clicks the "New" button in the toolbar, the canvas is cleared immediately. If the user has unsaved changes (the model is "dirty"), this leads to accidental data loss.

While the action can technically be reverted using Ctrl + Z, this is not a discoverable feature for new users, nor is it a standard pattern for destructive actions like clearing a project. A user who loses their work might not realize they can undo it and may end up restarting the project from scratch. (Like it happend to me that I had to do again the model).

Proposed Solution:
Implement a confirmation dialog that triggers only when the modeling section has unsaved changes.

  • Trigger: User clicks the "New" button.

  • Condition: Check if isDirty (or equivalent state) is true.

  • Message: "You have unsaved changes. Are you sure you want to create a new model? All current progress will be lost."

Actions:

Cancel: Closes the dialog and stays on the current model.

Confirm: Clears the canvas and starts a new model.

User Experience (UX):

This aligns with the behavior of existing confirmation dialogs (like issue #78 for field removal).

Prevents the "frustration factor" of losing complex schemas by a misclick.

Accesibilitie
Ensure the dialog follows ARIA patterns (role="alertdialog") and that focus is trapped within the modal when active.

Dominant language
TypeScript
Stars
139
Forks
40
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Lemoncode/mongo-modeler

All issues in Lemoncode/mongo-modeler

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.