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

New "save state" after tab duplication #416

Open
shangmu opened this issue Mar 4, 2020 · 6 comments
Open

New "save state" after tab duplication #416

shangmu opened this issue Mar 4, 2020 · 6 comments

Comments

@shangmu
Copy link

shangmu commented Mar 4, 2020

Not sure whether to file this as a feature (if at all feasible) or bug:

After the recent "save state" update, upon duplicating a tab (with neuroglancer in it) in chrome , the new tab shares the same state session id (or whatever it is called) as its sibling and causes the two tabs to covertly overwrite each other while still appearing different. The user would not notice loss of the state until closing and recovering the tab (for example, upon tab recovery after restarting chrome)

In my workflow I frequently duplicates my chrome tab to test out different dataset layers or look at different locations of same datasets and this would be a huge inconvenience, if not a problem.

Mitigation options in mind:

  • Create new session/storage id upon duplication of a tab
  • Create new session/storage id upon initial loading (so, effectively at duplication of a tab)
  • It could be potentially nicer if the URL still reflects a "state" id rather than a "state session/state storage" id.
@shangmu
Copy link
Author

shangmu commented Mar 4, 2020

Actually there appear to be more serious issues associated with this feature push. I just lost a whole tab (with its own unique local_id) just upon refreshing - somehow the whole local storage state is gone and all I am left with is an empty neuroglancer page.

I recognize that this warrants filing a separate bug, but for now I am just attaching the bug label and documenting this incident here as it's largely related.

@ogewan
Copy link

ogewan commented Mar 5, 2020

There is a history mechanism with the new save state module. The "$" shows all previously saved/shared states. If this state was shared, see if loading it from the history restores it. The error suggest that either the key doesn't exist or it does and the state it maps to is invalid.

With regard to save state duplication this is the intended behavior. Their is a little yellow warning dialog that warns against duplicating tabs primarily because the local_id is being utilized. Ideally, the local_id should never be utilized by the user for any reason and is only visible currently to preserve the tab in the case of reload/crashes. In the future, the local_id will be completely internal. The only thing the user will see is the neuroglancer.com.

The proper and unfortunately less intuitive way to duplicate a tab is to "share" that state with yourself, i.e duplicate the JSON link.

@shangmu
Copy link
Author

shangmu commented Mar 9, 2020

Local state disappearing from the state dict (would cause lost of state upon page refresh) happened for a third time today. local_id in three of my browser tabs are not found in the state dict, two of the three are current/foreground tabs of the respective window that I had left open from before the weekend. Chromium browser, version 80.0.3987.87.
The two foreground tabs were created by pasting in the state json into an empty NG page.

@shangmu
Copy link
Author

shangmu commented Mar 9, 2020

This disappearing-state issue appears to be due to overwriting the whole dict when writes happen from different tabs.

@shangmu
Copy link
Author

shangmu commented Mar 23, 2020

I guess I wasn't clear in my previous message (and private message) this is now 100% of the time reproducible. Steps to reproduce:

  1. Open a second neuroglancer page in a different tab, note its local_id is in the state dict (in javascript console).
  2. Go back to previous neuroglancer tab, do anything, e.g. scroll sections.
    Now observe in javascript console the second tab's local_id is gone from the state dict. - The bug.

And I believe this should be true too (not tested) this is true too:
3. Go to the second tab and do something. Then go back to the first tab and do a refresh (I know this is not supported but illustrates the problem): observe that anything you did in the original tab after creating the 2nd tab is gone.

It feels this could be something related to javascript closures or something

@ogewan
Copy link

ogewan commented Apr 7, 2020

Should be resolved by #429

If two tabs are modifying the same state, the ID of the older one will change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants