Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Data loss when using ComfyUI in multiple browser tabs #2251

Open
gremlation opened this issue Jan 15, 2025 · 4 comments
Open

[Bug]: Data loss when using ComfyUI in multiple browser tabs #2251

gremlation opened this issue Jan 15, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@gremlation
Copy link
Contributor

gremlation commented Jan 15, 2025

Frontend Version

  • ComfyUI: cba58fff0bfebfc81fbe678bb80491890a3df14a
  • Frontend: v1.7.11

Expected Behavior

  • I had an unsaved workflow in one browser tab by itself, no other ComfyUI tabs.
  • I had a second unsaved workflow in a second browser tab by itself, no other ComfyUI tabs.
  • I went to the first workflow and saved it.
  • I then went to the second browser tab, opened a second ComfyUI tab, and tried to open the saved workflow.
  • I couldn't see it - fair, I don't assume realtime syncing between different browser tabs.
  • I reloaded the browser tab to make it see the saved workflow.
  • I expected to have the two ComfyUI tabs reopen.

Actual Behavior

The first ComfyUI tab with the second unsaved workflow disappeared. I was left with just one empty ComfyUI tab in the second browser window.

Steps to Reproduce

See above.

Debug Logs

N/A

Browser Logs

N/A

Setting JSON

{
    "Comfy.DevMode": true,
    "Comfy.UseNewMenu": "Top",
    "Comfy.Settings.ExtensionPanel": true,
    "Comfy.Validation.NodeDefs": true,
    "pysssss.SnapToGrid": true,
    "Comfy.SnapToGrid.GridSize": 10,
    "Comfy.GroupSelectedNodes.Padding": 20,
    "Comfy.Graph.CanvasInfo": false,
    "Comfy.NodeBadge.NodeSourceBadgeMode": "None",
    "Comfy.NodeBadge.NodeIdBadgeMode": "None",
    "Comfy.TextareaWidget.FontSize": 16,
    "Comfy.LinkRenderMode": 2,
    "Comfy.ColorPalette": "dark",
    "pysssss.ShowImageOnMenu": true,
    "pysssss.AutoCompleter": false,
    "pysssss.ImageFeed.Location": "bottom",
    "Comfy.NodeSearchBoxImpl.ShowNodeFrequency": false
}

What browsers do you use to access the UI ?

Google Chrome

Other

No response

┆Issue is synchronized with this Notion page by Unito

@gremlation gremlation added the Potential Bug Untriaged bug label Jan 15, 2025
@huchenlei huchenlei added bug Something isn't working and removed Potential Bug Untriaged bug labels Jan 15, 2025
@christian-byrne
Copy link
Collaborator

christian-byrne commented Jan 15, 2025

Thank you for the detailed report.

At first, I thought this issue might be related to #2238, but it appears unrelated to both that and browser tabs.

Currently, only the active workflow is persisted in localStorage, allowing it to be restored on reload even if unsaved. However, other unsaved workflows are lost since this behavior applies exclusively to the active workflow. In #2238, we introduced persistence of tabs, but this is done lazily and not by actually saving the workflow content.

From a user perspective, the issue can be mitigated by enabling this option:

Selection_756

From a development perspective, potential solutions include adding an auto-save feature or extending the current persistence mechanism to all open tabs, not just the active one. Let me know your thoughts!

@christian-byrne
Copy link
Collaborator

I have also filed a Feature Request to improve the confirm-close dialog feature #2254

@gremlation
Copy link
Contributor Author

Currently, only the active workflow is persisted in localStorage, allowing it to be restored on reload even if unsaved. However, other unsaved workflows are lost since this behavior applies exclusively to the active workflow.

Reloading persisting some tabs but not others is not obvious or expected. I'm not sure what the logic is behind this either. Either unsaved work is important enough to be persisted or it isn't. Having it only happen some of the time and not even having it explained in the UI makes it very difficult to predict.

The setting you suggest is not enough either. Its message says "Reload site? Changes that you made may not be saved". It doesn't describe when things are or aren't saved. So if you normally work in one tab and you hit reload, you will be used to having your work saved and you won't pay much attention to the message because it will always be wrong. Then you happen to have two tabs open, and bam - data loss.

It also doesn't make sense to show the message in situations where there won't be any data loss. Why show the message when the user only has one tab open and there won't be any changes unsaved? All this does is teach users to ignore the message.

This is also a regression from when there weren't tabs. Before tabs, hitting reload would never result in data loss. Now it can, but only some of the time, and the circumstances that cause it to happen are not explained by the UI.

I guess I'm just confused at this whole approach, there doesn't seem to be any logic behind it. A fix to me would be consistent behaviour where all unsaved tabs are persisted and there is no warning, or none are persisted and there is a warning. There doesn't seem to be any upside to having it the way it is now.

@christian-byrne
Copy link
Collaborator

christian-byrne commented Jan 19, 2025

You make good points. This will likely be improved in the near future. I think #2258 does a bit to remedy it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants