JackDotJS / node-studio

Node-based music production tool, built with Tauri.
MIT License
7 stars 1 forks source link

multi-window support #25

Open JackDotJS opened 1 year ago

JackDotJS commented 1 year ago

something that may become an issue is having multiple instances of the app open at once. at first glance there doesn't seem to be anything wrong with this, but there's one glaring issue at hand: file system calls.

imagine this scenario: a user has two instances of the app open at once, maybe to edit two projects simultaneously for whatever reason. what happens when that user edits the app settings in one of those instances? simple, the other instance will now have an outdated version of the user configuration.

at this point we have at least three options:

  1. allow each window to use their own versions of the config and simply allow each one to write them to the disk as they're closed like normal. this means whichever instance is closed last will be the one with the final config used for future instances from that point forward.
  2. have each instance watch the config file after launching, and simply load any file changes as soon as they're written. im not sure how well node.js can handle multiple instances potentially attempting to read a single file all at once. keep in mind there could be more than 2 instances, so i think a conflict would be possible. would the read requests jusy be queued? then again i'd assume this is more up to the OS. how would this be handled?
  3. use some kind of IPC system to update all instances without having to interact with the file system at all. this could get uncomfortably complicated fast, and may even be massive overkill for this particular use case, but it is an option lol

would love feedback on this