Skip to content

Conversation

@krishx06
Copy link
Contributor

@krishx06 krishx06 commented Nov 11, 2025

Fixes #687

Summary:
Fixes the issue where the browser’s Back button freezes or skips pages after adding a table in the /editor view.

Problem:

  • Each autosave triggers save() in Workspace.jsx, which always calls setSearchParams(searchParams); even when no URL changes are needed.
  • This pushes a new /editor entry to browser history on every save, causing the Back button to become unresponsive or require multiple presses.

Solution:

  • Only call setSearchParams() when shareId exists in the URL.
  • Use { replace: true } to replace the current history entry instead of pushing new ones.
if (saveAsDiagram) {
  if (searchParams.has("shareId")) {
    searchParams.delete("shareId");
    setSearchParams(searchParams, { replace: true });
  }
}

Result:

  • No duplicate /editor entries in browser history.
  • Back navigation now works smoothly after adding tables.
  • Autosave and URL updates remain fully functional.

Verification:

  1. Navigate from / → /editor.
  2. Add a new table (triggers autosave).
  3. Press Back → returns immediately to /.
  4. Repeat to confirm consistent behavior.
Screen.Recording.2025-11-12.at.12.51.06.AM.2.MOV

Notes:
This PR makes a minimal, targeted change to fix the root cause without affecting other functionality or state handling.

@vercel
Copy link

vercel bot commented Nov 11, 2025

@krishx06 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
Copy link

vercel bot commented Nov 12, 2025

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

Project Deployment Preview Comments Updated (UTC)
drawdb Ready Ready Preview Comment Nov 12, 2025 6:26am

Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

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

thank you!

@1ilit 1ilit merged commit 9df18ec into drawdb-io:main Nov 12, 2025
4 checks passed
ewqazxc pushed a commit to ewqazxc/drawdb that referenced this pull request Nov 13, 2025
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.

[BUG] Back navigation from /editor skips or freezes homepage

2 participants