Skip to content

fix: incorrect workflow loaded from draft storage on page reload #9317

@dante01yoon

Description

@dante01yoon

Bug

When a user refreshes the page, a different workflow loads instead of the one they were working on.

Root Cause

Two interacting bugs in useWorkflowPersistenceV2.ts:

  1. Draft cleanup removes active workflow's draft (line 124-127): Saved, unmodified workflows have their drafts removed during persistence. On reload, the session path lookup fails and fallbackToLatestDraft loads a completely different workflow.

  2. Tab restoration never activates the correct workflow (line 274-277): restoreWorkflowTabsState() calls openWorkflowsInBackground() which only adds paths to the tab bar but never calls openWorkflow() on the active tab.

Reproduction

  1. Open two workflows: A (saved, unmodified) as active tab, B (modified) as background tab
  2. Wait for persistence debounce (512ms)
  3. Refresh the page
  4. Workflow B is loaded instead of A

Related Issues

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions