fix: Canvas auto-save is never enabled on a fresh browser when versioning is on#3756
fix: Canvas auto-save is never enabled on a fresh browser when versioning is on#3756forestileao merged 4 commits intomainfrom
Conversation
…pendency When canvas versioning is enabled, auto-save is now always active regardless of localStorage state. This fixes a regression where a fresh browser (no localStorage) would default auto-save to disabled, causing the header to perpetually show 'Unsaved'. Changes: - Remove CANVAS_AUTO_SAVE_STORAGE_KEY and localStorage read/write - Simplify canAutoSave to depend only on isTemplate and hasEditableVersion - Remove handleToggleAutoSave callback - Remove auto-save toggle Switch UI from Header - Remove isAutoSaveEnabled/onToggleAutoSave/autoSaveDisabled props from CanvasPage and Header prop chains Closes #3750
|
👋 Commands for maintainers:
|
|
/sp start |
|
✅ Ready. Web: https://pr-3756-ephemeral.superplane.com |
|
@cursoragent Create an e2e test for that:
|
|
Added the requested e2e test in
The test compiles cleanly with |
Verifies that a versioned canvas auto-saves after moving a node: - Creates a canvas with organization versioning enabled - Enters edit mode - Adds a noop node and waits for save - Moves the node by dragging it - Asserts the save status indicator reaches 'saved' state
|
@cursoragent didnt work |
|
Fixed two issues in the e2e test:
|
- Use q.Locator with proper space-to-dash conversion for node header data-testid (q.TestID does not convert spaces within segments) - Dismiss sidebar before moving node to ensure the node is accessible - Add helper nodeHeaderSelector matching the DOM convention
…ning is on (superplanehq#3756) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Summary Fixes superplanehq#3750 When canvas versioning is enabled, opening the UI in a fresh browser (no localStorage) caused the auto-save indicator to always show "Unsaved". This happened because `isAutoSaveEnabled` was still being read from localStorage, and the default for a fresh browser was effectively `false` when the stored value was absent and parsed incorrectly. ## Root Cause The auto-save toggle was previously removed from the UI, but the underlying localStorage-based state management (`CANVAS_AUTO_SAVE_STORAGE_KEY`) was never replaced with a static `true`. The `canAutoSave` flag still depended on `isAutoSaveEnabled` (from localStorage) when versioning was enabled, so a fresh browser with no stored value would not auto-save. ## Changes **`web_src/src/pages/workflowv2/index.tsx`** - Removed `CANVAS_AUTO_SAVE_STORAGE_KEY` constant and all localStorage read/write for auto-save - Simplified `canAutoSave` to `!isTemplate && hasEditableVersion` (always enabled when conditions are met) - Removed `handleToggleAutoSave` callback - Removed `isAutoSaveEnabled`, `onToggleAutoSave`, `autoSaveDisabled`, `autoSaveDisabledTooltip` props from `CanvasPage` rendering **`web_src/src/ui/CanvasPage/index.tsx`** - Removed `isAutoSaveEnabled`, `onToggleAutoSave`, `autoSaveDisabled`, `autoSaveDisabledTooltip` from all interface definitions and prop threading (3 interfaces, 4 render sites) **`web_src/src/ui/CanvasPage/Header.tsx`** - Removed auto-save toggle props from `HeaderProps` interface - Removed the auto-save `Switch` toggle UI from the header - Removed unused `Switch` import **`test/e2e/canvas_auto_save_test.go`** (new) - E2E test that verifies auto-save works on a versioned canvas: 1. Creates a canvas with organization versioning enabled 2. Enters edit mode 3. Adds a noop node and waits for save 4. Dismisses the sidebar, then moves the node by dragging its header 5. Asserts the save status indicator reaches "saved" state ## Result Auto-save is now statically enabled whenever the canvas has an editable version and is not a template. The header correctly reflects the saved/synced state instead of perpetually showing "Unsaved". <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-033b248e-abec-4a5b-8d51-1aab0c2fbddd"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-033b248e-abec-4a5b-8d51-1aab0c2fbddd"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Pedro Leão <60622592+forestileao@users.noreply.github.com>


Summary
Fixes #3750
When canvas versioning is enabled, opening the UI in a fresh browser (no localStorage) caused the auto-save indicator to always show "Unsaved". This happened because
isAutoSaveEnabledwas still being read from localStorage, and the default for a fresh browser was effectivelyfalsewhen the stored value was absent and parsed incorrectly.Root Cause
The auto-save toggle was previously removed from the UI, but the underlying localStorage-based state management (
CANVAS_AUTO_SAVE_STORAGE_KEY) was never replaced with a statictrue. ThecanAutoSaveflag still depended onisAutoSaveEnabled(from localStorage) when versioning was enabled, so a fresh browser with no stored value would not auto-save.Changes
web_src/src/pages/workflowv2/index.tsxCANVAS_AUTO_SAVE_STORAGE_KEYconstant and all localStorage read/write for auto-savecanAutoSaveto!isTemplate && hasEditableVersion(always enabled when conditions are met)handleToggleAutoSavecallbackisAutoSaveEnabled,onToggleAutoSave,autoSaveDisabled,autoSaveDisabledTooltipprops fromCanvasPagerenderingweb_src/src/ui/CanvasPage/index.tsxisAutoSaveEnabled,onToggleAutoSave,autoSaveDisabled,autoSaveDisabledTooltipfrom all interface definitions and prop threading (3 interfaces, 4 render sites)web_src/src/ui/CanvasPage/Header.tsxHeaderPropsinterfaceSwitchtoggle UI from the headerSwitchimporttest/e2e/canvas_auto_save_test.go(new)Result
Auto-save is now statically enabled whenever the canvas has an editable version and is not a template. The header correctly reflects the saved/synced state instead of perpetually showing "Unsaved".