(Custom) widget wont reload when used in page layout
I’m playing around with a custom widget. This widget will let it snow with some react magic. (react-snowfall / https://www.npmjs.com/package/react-snowfall ) Although I missed the x-mass deadline, the widget now works and will let it snow within the <div> it is rendered. Since we all like a lot of snow and not some local snowfall, I have duplicated a default layout and added the widget to the “region-content” of this layout. This gives the desired effect. When I navigate to another page with the same layout the widgets keeps running (if I understand correctly the layout is not reloaded in this case). When I navigate to another page with a different layout the widgets stops running. But when I now navigate back to the page with the widget in the layout, the widget effect is not shown. The effect is shown again after I refresh the page with CTRL+F5 . Any pointers on why this is? Can I force the widget to “render” again when I navigate back to the page? I added an example → https://letitsnow-sandbox.mxapps.io/ - Use CTRL + F5 if it does not snow. - Click from menu item 1 to 3 and back again. The widget keeps running. (pages use the same layout) - Click on menu item 2. Widget in the layout stops (this uses another layout) - Click back to menu item 1 or 3. Widget won’t show the snow effect.
Have you tried closing the page containing the custom layout first, before opening the next page without the custom layout?
I guess it has something to do with the way pages are handled by the runtime. My guess is if you put the widget inside a dataview it will render everytime.