The app should have a single instance to access db. - BoostNote.next

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.

Asked Oct 03 '21 11:10
avatar Rokt33r
Rokt33r

5 Answer:

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

1
Answered Apr 26 '20 at 13:59
avatar  of jhdcruz
jhdcruz

@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

1
Answered Apr 26 '20 at 16:27
avatar  of Rokt33r
Rokt33r

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
1
Answered May 01 '20 at 09:22
avatar  of ZeroX-DG
ZeroX-DG

@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.
1
Answered May 02 '20 at 18:33
avatar  of Rokt33r
Rokt33r

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.

1
Answered Aug 24 '21 at 00:55
avatar  of Rokt33r
Rokt33r