Show Page Action - Odd behaviour with pluggable widgets

0
We are using the ‘show page’ action to do a ‘refresh’ (in mendix terms...) of the current page and force a legacy react widget we are integrate to run its’ on mount code again.  However, when doing this what we are seeing is that the on mount code is run, followed by the unmount code which essentially leaves the widget in an unhandled state (in our case it means that subscriptions are created and immediately destroyed) The expectation is that using 'show page' to refresh the current page should cause all pluggable widgets to unmount, then mount. A created a minmal project to reproduce the issue and can reproduce using a class component, like so:   class Test extends Component { constructor(props) { super(props) } componentDidMount() { console.warn('On Mount'); } componentWillUnmount() { console.warn('On Unmount'); } render() { return <div>Component mount/unmount test</div> } } Or with hooks: function Test (props){ useEffect(() => { console.warn('useEffect callback'); return () => { console.warn('useEffect closure (cleanup)'); } }, []) return ( <div>Use Effect Test - check console</div> ); } Simply create a pluggable widget as above and add it to your page along with a ‘Show Page’ button which shows the current page. The expected console are: - ‘On Mount’  (for the first time the page is loaded – now press the button) - ‘On Unmount’ - ‘On Mount’   Instead, we get: - ‘On Mount’ - ‘On Mount’ - ‘On Unmount’     Anyone have an idea if this is a mendix issue or can be solved somehow?      
asked
0 answers