Read the statement by Michael Teeuw here.
MMM-NEWS problem
-
REFRESHING MM, not RESTARTING could make problems on many modules(including mines.). Regardless some modules would be not affected, but some would.
It depends on design of module structure. I do some tricks on
DOM_OBJECTS_CREATED
as a signal for ready of working. When MM is started and be ready for all DOM being prepared, that notification is emitted. Only one time emittance of that notification is expected during execution, not twice or more. But REFRESHING will break that agreement.When MM Front is refreshed, MM modules would be restarted but some background-procedures (like node_helper.js or related background external scripts) are not killed or restarted properly. Because, many of them are not designed to be REFRESHED.
REFRESHING is some kind of interrupt from User. It couldn’t be predicted or postponed by condition. so, cannot be done killing or restarting process gracefully and safely.So, It’s better not to REFRESH. RESTART MM instead.
-
ok i get it now thank you @Sean .I resolved all the problems i had with my modules except MMM-NEST-STATUS,so i dont need to refresh any more.Thanx again for the explanation.
-
@sean Your Module is being restarted as the server is reset.
If your module causes problems with hard refreshes then its non compatible with any browser as when a browser cache is cleared its cleared.
If refreshing after that causes problems then its bad programming with your module.
Its doesn’t cause problems with a hard refresh though as the cache is cleared, there is no dom as it starts a fresh and the page its pulled in as if the browser had just been started.Do you understand the difference between a hard refresh and soft refresh?
Name your module and I will tell you if its causes problems when hard refreshed? -
@stuartiannaylor
No cache related problem. I’m saying background process.
Let’s assumenode_helper.js
hosts some external python script for its job. The script might be started onstart()
. In that case, REFRESHING doesn’t affect any harm side-effect to the script because it is already running on.
But if the script needs to be executed with some data of runtime after module starts, you cannot put that script execution instart()
. That script should be executed bysocketNotification
somewhere.
REFRESHING makes thatsocketNotification
transferring several times without any preparation. You cannot kill the background python script to restart it gracefully before User’s REFRESHING by force.Of course, Developer can make codes to avoid this by checking current running script. but why? MM is not designed to be refreshed by user. (nonetheless whether it is possible or not)
-
@sean Look I am using many modules and hard refreshing with zero problems.
Tell me what your module is and what it is supposed to do under a hard refresh and what error it will cause.
I already know the answer none, but hey will test it and see.Every module I install on config change auto restarts the server which takes seconds. The connection between browser and server is broken.
Browser waits for server to say hey port 8080 is ready then browser hard refreshes.
It takes 10 - 20 seconds 10 for server and the browser still holds the last screen then on ready hard refresh, browser dumps its cache and its the same as first time connection to the site.
Yes you can hard refresh and its vastly quicker than killing a browser for absolutely no apparent reason apart some misunderstanding of actual use.
Its vastly faster than killing and reloading the browser and its seemless without any horrid white screens oh awe snap or whatever it says.
Install my guide on a Pi and watch it do as I am trying to say.https://github.com/StuartIanNaylor/MagicMirror-Install-Guide-Raspberry-0-to-3
-
@stuartiannaylor
First I can’t understand why are you teaching me about usage. :D I’m not the who is trying any HARD or SOFT refreshing.I believe you are using many modules without problem. But I’m also developing above 30+ MM modules for this community for some years. :D
I already know WHAT ERROR some of my modules might have when MM is refreshed. And know also it is just caused by its design. I’m saying just some modules could not be working due to its design when a user refreshes MM by force.
-
@sean Just say what it is and which module and I will test it and prove either you or I are right.
Its that simple as every module I install when I click save on config.js I never need to kill my browser and have gone through 5 to 10 modules at least without trouble and without restart.
Just say which modules and lets test to see who is mistaken?Browsers are stateless and if the server has been reset and the browser drops its cache its the same as running new.
-
@stuartiannaylor
I think this is very meaningless argues.
Anyway, This thread is posted by @costascontis originally. He had a problem withMMM-News
whenever he does screen refreshing withCtrl+R
. And as a creator of this module, I answered this module is not designed for that unexpected action. That’s all.
So, See that module and explain me anything what you want. -
@sean ctrl+r is a soft refresh not a hard refresh and it retains the cache.
Its only piontless because for some reason you will not simply state the modules you know have problems with hard refreshes.
Needs to be ctrl+F5 with chromium or whatever the shortcut key for hard refresh is.
-
@stuartiannaylor
I’M NOT THE WHO HAS PROBLEM WITH REFRESHING. @costascontis is the one who ask this things. So you seems to be speaking to wrong person.