πŸ‡ΊπŸ‡¦ We stand with Ukraine! πŸ‡ΊπŸ‡¦

"Settings update detected"

Hi !

Searching the forum : no answer. Searching the web with Google : 4 answers, but still no explanations... I also tried to get answers from OctoPrint sources : no luck...

I don't understand this message. How I get it : I implemented a "Apply now" button in a plugin settings page, that calls savePluginSettings() in the associated js file.

I don't really understand what it means. For what I'm doing, "Reload now" or "Reload only non-conflicting changes" or clicking outside (cancelling ?) makes no difference. And clicking outside has no effect if
"Close dialogs by clicking outside" is unchecked in the "OctoPrint/Appearance" options. Tehre's no "Cancel" button...

I tried finding sources for on_settings_save(), in order to understand and overload this function. No success.

What does this cryptic message mean, how to avoid it, and hos to know if it is legit ?

Sorry for flooding the development section, but there's not that much people developping plugins

If anything modifies the settings while the settings dialog is open, then this message will likely turn up. It stops conflicts where settings are modified but the user is not aware.

The problem is keeping sync with the server and the client. When you load the UI, the settings are fetched from the server and stored in memory in the browser. In the settings dialog they are modifiable, which changes the in-memory browser version until you press 'save'. If you change some settings while the settings dialog is open outside of pressing save, the in-memory settings are now different to the server, so saving these may unintentionally overwrite other values. So a dialog asking you to reload the settings is popped up.

Why do you need an 'Apply now' button in your plugin's settings - this is what the 'save' button at the bottom right does usually? Is there some specific feature that needs this?

More plugin developers also watch the #dev-plugins channel on the OctoPrint discord server, if you want less formal conversations about stuff you are doing every now and then.

Now I understand !

I need an "Apply now" button because the plugin is modifying the graphics attributes for an overlay window, and these attributes are stored in config.yaml, then read by the service displaying the window.

Maybe not the best idea, but the APIs made it easy with minimal code. Writing directly to config.yaml using file and string functions should be the solution.

The settings dialog is intended to edit these graphical properties using a PC/tablet/phone, while the overlay window is displayed on the Raspberry Pi LCD or in VNC. Easier than closing the overlay, changing attributes, save/close, reopen and so on. Ideally, it should even be real time, without any button. Later...

I'll have a look to Discord. Thanks for the information.

Maybe create your own API endpoint that does the save server side behind the scenes in python rather than using the js save function. The would avoid the pop-up you are seeing.