Skip to content

Fix: save dialog doesn't navigate away when save is a duplicate#24

Open
ImranFarhat01 wants to merge 1 commit into
FOSSEE:developfrom
ImranFarhat01:fix/duplicate-save-navigation
Open

Fix: save dialog doesn't navigate away when save is a duplicate#24
ImranFarhat01 wants to merge 1 commit into
FOSSEE:developfrom
ImranFarhat01:fix/duplicate-save-navigation

Conversation

@ImranFarhat01

Copy link
Copy Markdown

Problem

Save-and-navigate dialogs shown when leaving the editor via Dashboard,
Gallery, or Simulator nav links stayed open indefinitely if the saved
content was unchanged since the last save, with no feedback to the user.

Root Cause

The backend returns duplicate: true when the posted content matches
an existing save with the same branch. The frontend success handler
only called the navigation callback when the response was not a
duplicate:

if (!res.data.duplicate) { setVersions(res.data.version, false, null) }

This likely intended to skip creating a redundant version record, but
it also skipped navigation entirely, leaving the user stuck with no
indication the save had already succeeded.

Fix

Always call setVersions regardless of duplicate status, so navigation
proceeds whether or not a new version was created.

Testing

  • Saved a circuit, made no changes, triggered the Dashboard
    save-and-navigate dialog again: backend correctly returned
    duplicate: true, and the dialog now navigates to the dashboard
    as expected
  • Confirmed regular (non-duplicate) saves still navigate correctly

…ug 15)

Save-and-navigate dialogs shown when leaving the editor via Dashboard,
Gallery, or Simulator nav links stayed open indefinitely if the saved
content was unchanged since the last save (backend returns
duplicate: true), with no feedback to the user.

Root cause: the success handler only called the navigation callback
(setVersions) when the response was not a duplicate:

  if (!res.data.duplicate) { setVersions(res.data.version, false, null) }

This likely intended to skip creating a redundant version record, but
it also skipped navigation entirely, leaving the user stuck with no
indication that the save had already succeeded.

Fix: always call setVersions regardless of duplicate status, so
navigation proceeds whether or not a new version was created.
@ImranFarhat01 ImranFarhat01 changed the title Fix: save dialog doesn't navigate away when save is a duplicate (Bug 15) Fix: save dialog doesn't navigate away when save is a duplicate Jun 16, 2026
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.

1 participant