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

Query/UI: state is shared between windows #4004

Closed
asuffield opened this issue Mar 31, 2021 · 7 comments · Fixed by #4015
Closed

Query/UI: state is shared between windows #4004

asuffield opened this issue Mar 31, 2021 · 7 comments · Fixed by #4015

Comments

@asuffield
Copy link

#2578 was only partially fixed, and the same problem still occurs when multiple browser windows are used.

Reproduction sequence:

  1. Open two browser windows, which we'll call A and B
  2. Type a query into window A and click execute
  3. In window B, toggle the deduplication or partial query options
  4. Click execute in window A
  5. You are now looking at the results of running the query in window A with the options from window B. Nothing in window A will indicate this has occurred.
@saswatamcode
Copy link
Member

saswatamcode commented Apr 1, 2021

The issue you mentioned seems to be for multiple panels in the same window. What should the desired behviour be? The new browser window/tab being treated like a new panel?

@asuffield
Copy link
Author

#2578 was for all panels in general; the partial fix made it work for browser instances which only have a single window open.

Desired behaviour is an interesting question - there are several reasonable options. The current behaviour is obviously wrong, but it's less obvious which of the options is right. Some options include:

  1. When the option is toggled in one window, all other windows are updated to reflect the change (easy fix, at least it's then clear what's going on, but probably a horrible user experience)
  2. Scrap the idea of keeping state in localstorage and put all the options in the URL (easy fix, big change to UX, maybe more consistent)
  3. Something else?

@saswatamcode
Copy link
Member

Yup. Also seems like when I open multiple panels on one browser window, and then open another window, the same number of panels aren't reflected, but the first one appears to be treated as id 0 🤔 . What do you think? @bwplotka @onprem

@onprem
Copy link
Member

onprem commented Apr 1, 2021

Ah yes, we identify the first panel as 0 and so if you open another tab, the first panel there will also be treated as 0. Now the thing is, we use localStorage in the browser to persist the settings of a panel, so if you change settings for panel 0 in the first tab, it will also affect the settings for panel 0 in the second tab.

This can be solved if we can somehow uniquely identify each tab, but the problem is, there is no way to know if multiple tabs are open and then which tab we are currently in.

I can't think of an easy way to solve this without completely removing the localStorage persistence layer.

@saswatamcode
Copy link
Member

saswatamcode commented Apr 1, 2021

The problem is that the changing the settings for one panel doesn't seem to update it across the diff browser tabs open (the UI doesn't show the correct options, but requests do). Also the number of panels across tabs aren't the same. Would be great if we could listen for changes in localStorage and change that. Completely removing the layer and relying on something else seems to be a long-term goal, right?

@asuffield
Copy link
Author

What is the localStorage persistence supposed to accomplish? I've always found it confusing that two people will get different results from the same link, depending on what is set in there.

@saswatamcode
Copy link
Member

Should store options for multiple panels and help reflect that in the UI and ensure there's no sharing of state between those panels.

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 a pull request may close this issue.

3 participants