Submodule Auto Reload Specifics

Are there specific requirements that cause sub-modules "auto-reload" to have a hard reset/refresh or a soft one?

To be clearer, some of my sub-modules when I'm saving seem to debug like this

(INFO) Submodule changed: D:\Users\Dillon\Dropbox (Personal)\OSC\cubase\selectVoice.js
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully

whilst others, seem to actually use the unload() method, which I have debugging consoles to verify.

// this occurs when I save on the main.js custom module
(INFO) Custom module changed: D:\Users\Dillon\Dropbox (Personal)\OSC\main.js
app:unload saved and reloading +0ms
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully
// this however occurs when I alterd my init() method 
//which is called when osc's init()
(INFO) Submodule changed: D:\Users\Dillon\Dropbox (Personal)\OSC\oscFilters\init.js
app:unload saved and reloading +0ms
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully

If there aren't specifics or rules which spawn a soft reset or hard reset (forces unload() to be used), is there a way we could tell OSC to do this?

My reasoning for a hard reset is, when working in a nested submodule, I'd like to save it and have OSC reload, as the workaround now is to save the submodule, then force a save on the main.js to cause the app to refresh and unload() to initiate.

Cheers,
DMDComposer

There should be no "soft" reset, the custom module including submodules is supposed to be reloaded upon changes made to any of its files. I'll check this out and keep you posted.

1 Like

I did a small test this morning and the main module's unload() seems to be called regardless of which module was modified, could you please post some code to help understand your module's structure ?

1 Like

Hey Jean,

Thank you for investigating. I've recreated an example module flow from my main OSC, which reproduced the problem. The flow is as follows:

main.js > oscFilter.js > test.js > testInner.js

When saving within oscFilter or the first level down "test module" it works. When saving in the "testInner.js" which is nested within the "test.js", the saving does not initiate the "unload" as I described in my first post.

I am launching this from the latest version, using node not the osc GUI launcher / headless. I've attached a zip of the test. Here is the log and my steps to reproduce, and unload.js will console.log("saved and reloading osc") until we reach testInner.js.

  1. Launch using npm run start
  2. Save on main.js
  3. Save on oscOutFilter.js
  4. Save on test.js
  5. Save on testInner.js (this is where it won't console.log from unload.js as shown below on my console.log)
$ npm run start

> osc-templates@1.4.0 start
> node "C:/Program Files (x86)/Open Stage Control/resources/app" -- --config-file "./Config Settings/OSC Config Settings 10_30_2022.config" --use-ssl

(INFO) Headless mode (--no-gui) enabled automatically (running with node)
(INFO) Using self-signed ssl certificate in cache
init
(INFO) Server started, app available at 
    https://192.168.1.11:8080
    https://10.0.0.11:8080
    https://169.254.20.249:8080
    https://169.254.113.93:8080
    https://127.0.0.1:8080
    https://172.30.0.1:8080
created
(INFO) Custom module changed: C:\AHK Scripts\_DMD Scripts\_OSC Delete\main.js
saved and reloading osc
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully
(INFO) Submodule changed: C:\AHK Scripts\_DMD Scripts\_OSC Delete\oscFilters\oscOutFilter.js
saved and reloading osc
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully
(INFO) Submodule changed: C:\AHK Scripts\_DMD Scripts\_OSC Delete\tests\test.js
saved and reloading osc
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully
(INFO) Submodule changed: C:\AHK Scripts\_DMD Scripts\_OSC Delete\tests\testInner.js
(INFO) Reloading custom module...
(INFO) Custom module reloaded successfully

Just perhaps need to change the location of OSC and main.js in the osc Config file / package.json to launch correctly. I'm sure you know what you're doing Jean haha :wink:

Cheers!
-DMDComposer
OSC Test for Jean.zip (82.5 KB)

Thanks, I managed to reproduce it with your files, it seems reloading breaks for all submodules that are nested in 3+ levels of require(), the investigation goes on...

1 Like

Fixed, v1.21.0 is cooking now.

2 Likes

Nice! That was wicked quick. You rock, Jean! :metal: