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

Multiple tabs keep losing selections #127

Open
mtfurlan opened this issue Aug 29, 2022 · 1 comment
Open

Multiple tabs keep losing selections #127

mtfurlan opened this issue Aug 29, 2022 · 1 comment

Comments

@mtfurlan
Copy link

If a user has multiple tabs open (such as a bunch of presenters from the people list), and changes selected items in each tab, only the selections done in the last tab will be saved.

It looks like this happens because each tab loads the selections at page load, and the blindly writes what it loaded plus what the user selected: https://github.com/lostcarpark/conclar/blob/main/src/model.js#L159

I think reading the local storage every time a user changes a selection instead of assuming what it read on page load is correct would solve the problem.

There technically could still be race condition stuff if two tabs do stuff at the exact same time, I don't think that would happen in a real world usecase because local storage is measured in ms, so a user would have to be doing stuff on two tabs at the exact same time.

@lostcarpark
Copy link
Owner

Thanks for pointing this out. Definitely an oversight on my part. Reloading the selections before writing the updated selections definitely sounds like a good idea.
I'm considering moving some of the stored data from LocalStorage to IndexedDB. Not sure whether the selections would be part of this, though.

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

No branches or pull requests

2 participants