Open vtni opened 5 years ago
I fixed this using the event triggered by the back button to update the alert state
componentDidUpdate(){ window.onpopstate = (e) => { this.setState({ alert:false }) } }
In Chrome 77 "window.onpopstate" working only after user interaction.
I fixed this using the event triggered by the back button to update the alert state
componentDidUpdate(){ window.onpopstate = (e) => { this.setState({ alert:false }) } }
I fixed this using the event triggered by the back button to update the alert state
componentDidUpdate(){ window.onpopstate = (e) => { this.setState({ alert:false }) } }
Unfortunately, I get the same error:
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
When changing the url (clicking browsers back button), the component is unmounted, but still visible. Is it possible to hide then also the SweetAlert dialog? I tried it with
forceUpdate()
, but the rendering method is not called anymore aftercomponentWillUnmount()
.Thank you