[GH-ISSUE #440] The app should have a single instance to access db. #209

Closed
opened 2026-03-03 00:19:19 +03:00 by kerem · 6 comments
Owner

Originally created by @Rokt33r on GitHub (Apr 26, 2020).
Original GitHub issue: https://github.com/BoostIO/BoostNote-App/issues/440

From https://github.com/BoostIO/BoostNote.next/issues/67#issuecomment-568688930

Users can open multiple windows of BoostNote.next app. This behavior is not intended so it could cause several problems because there are no communication measures between the windows.
I'm not sure what kind of problems could happen. But I think it is better to coerce the app to have only one instance(main window) to access db.

Originally created by @Rokt33r on GitHub (Apr 26, 2020). Original GitHub issue: https://github.com/BoostIO/BoostNote-App/issues/440 From https://github.com/BoostIO/BoostNote.next/issues/67#issuecomment-568688930 Users can open multiple windows of BoostNote.next app. This behavior is not intended so it could cause several problems because there are no communication measures between the windows. I'm not sure what kind of problems could happen. But I think it is better to coerce the app to have only one instance(main window) to access db.
Author
Owner

@jhdcruz commented on GitHub (Apr 26, 2020):

Users can open multiple windows of BoostNote.next app. This behavior is not intended so it could cause several problems because there are no communication measures between the windows.

Is it like the app.requestSingleInstanceLock() implemented on the old BoostNote app?

github.com/BoostIO/Boostnote@3c0f20f364

<!-- gh-comment-id:619554320 --> @jhdcruz commented on GitHub (Apr 26, 2020): > Users can open multiple windows of BoostNote.next app. This behavior is **not intended** so it could cause several problems because there are no communication measures between the windows. Is it like the `app.requestSingleInstanceLock()` implemented on the old BoostNote app? https://github.com/BoostIO/Boostnote/commit/3c0f20f364a41e651fce168224fb77820fa6d7be
Author
Owner

@Rokt33r commented on GitHub (Apr 26, 2020):

@jhdcruz Yes it is. If you want to try it, please check here for more information! https://www.electronjs.org/docs/api/app#event-second-instance

<!-- gh-comment-id:619580094 --> @Rokt33r commented on GitHub (Apr 26, 2020): @jhdcruz Yes it is. If you want to try it, please check here for more information! https://www.electronjs.org/docs/api/app#event-second-instance
Author
Owner

@ZeroX-DG commented on GitHub (May 1, 2020):

To apply fix for the web version, we can implement something simple such as saving a instance counter in localStorage, when user close tab or window, the counter should be updated therefore when a new tab or window load the app, we check the counter first before connecting the app. However, I don't think JS can force tab focus so there are 4 solutions that I think we can use:

Solution Pros Cons
Show popup to tell users to change to their previous tab that opened the app Easy to implement Not very good user experience
Close the tab when the app is already open in another tab Very easy to implement Bad user experience
Show popup to tell users to change to their previous tab that opened the app then close after user click ok Easy to implement and better user experience than 2nd solution Still not very good user experience
Using web worker to run in background to check if there's a tab open, if the user try to access the app in the second tab, close the first tab Better user experience Complex to implement
<!-- gh-comment-id:622316180 --> @ZeroX-DG commented on GitHub (May 1, 2020): To apply fix for the web version, we can implement something simple such as saving a instance counter in localStorage, when user close tab or window, the counter should be updated therefore when a new tab or window load the app, we check the counter first before connecting the app. However, I don't think JS can force tab focus so there are 4 solutions that I think we can use: | Solution | Pros | Cons | |------------|-------|---------| | Show popup to tell users to change to their previous tab that opened the app | Easy to implement | Not very good user experience | | Close the tab when the app is already open in another tab | Very easy to implement | Bad user experience | | Show popup to tell users to change to their previous tab that opened the app then close after user click ok | Easy to implement and better user experience than 2nd solution | Still not very good user experience | | Using web worker to run in background to check if there's a tab open, if the user try to access the app in the second tab, close the first tab | Better user experience | Complex to implement |
Author
Owner

@Flexo013 commented on GitHub (May 1, 2020):

The 3rd option has my preference

<!-- gh-comment-id:622496460 --> @Flexo013 commented on GitHub (May 1, 2020): The 3rd option has my preference
Author
Owner

@Rokt33r commented on GitHub (May 2, 2020):

@ZeroX-DG Good start! I think closing any tabs is too aggressive. Rather than closing the tab, we should just suspend the app.

So I think when a user opens another tab, we should suspend the app in the old screen and show a dialog

Activate App

BoostNote.next is activated in other window(or tab). Once the app is activated in this window, the one in the other window(or tab) will be suspended.
<!-- gh-comment-id:622995953 --> @Rokt33r commented on GitHub (May 2, 2020): @ZeroX-DG Good start! I think closing any tabs is too aggressive. Rather than closing the tab, we should just suspend the app. So I think when a user opens another tab, we should suspend the app in the old screen and show a dialog ``` Activate App BoostNote.next is activated in other window(or tab). Once the app is activated in this window, the one in the other window(or tab) will be suspended. ```
Author
Owner

@Rokt33r commented on GitHub (Aug 24, 2021):

This issue is not valid anymore since we've discarded the legacy cloud storage from this app. You can open multiple tabs and windows. All data will be synced via WebSocket and server-side events.

<!-- gh-comment-id:904235138 --> @Rokt33r commented on GitHub (Aug 24, 2021): This issue is not valid anymore since we've discarded the legacy cloud storage from this app. You can open multiple tabs and windows. All data will be synced via WebSocket and server-side events.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/BoostNote-App#209
No description provided.