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

Prevent multiple instances #2987

Open
pyrareae opened this issue Jan 18, 2024 · 1 comment
Open

Prevent multiple instances #2987

pyrareae opened this issue Jan 18, 2024 · 1 comment

Comments

@pyrareae
Copy link

Problem Statement

Possible solution for #2942

There is nothing stopping you from opening multiple instances of the spa/web-app, which in turn may lead to data corruption issues such as in #2948.

❔ Possible Solution

It should be possible to query if there are any running instances via a BroadcastChannel message. We should be able to ping for any other running instances on startup and abort if we get a response from one.

Flow:

  • Instance A starts up and pings "existingInstance" message and receives no reply.
  • Instance A sets up a listener for "existingInstance" that just echos "pong" or something.
  • Instance B starts up and pings for "existingInstance", and receives "pong" from instance A.
  • Instance B warns the user there is already a running instance and shuts down.

⤴️ Describe alternatives you've considered

There are some other inter-window/tab communication techniques/apis but BroadcastChannel seems to be the most flexible. it would be possible for example set a cookie or local storage flag but that has issues such as a bad shutdown could leave it in a bad state.

➕ Additional context

Related: #2942
Related: #2948

Copy link

Thank you very much for opening up this issue! I am currently a bit overwhelmed by the many requests that arrive each week, so please forgive me, if I fail to respond personally. I am still very likely to at least skim read your request and I'll probably try to fix all (real) bugs if possible and I will likely review every single PR being made (please, give me a heads up if you intent to do so) and I will try to work on popular requests (please upvote via thumbs up on the original issue) whenever possible, but trying to respond to every single issue over the last years has been kind of draining and I need to adjust my approach for this project to remain fun for me and to make any progress with actually coding new stuff. Thanks for your understanding!

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

3 participants