useWarnOnPageUnload is causing a native warning to be displayed after a group has been created, because we do a synchronous redirect via window.location.href = ... as part of the form's onSubmit.
The same callback also updates a piece of state that should avoid that warning, but the state is not synced in time.
This PR avoids a synchronous redirect, and instead adds a second piece of state which holds the location to redirect to. Then using useEffect we do the redirection once that state has been set.
useWarnOnPageUnload
is causing a native warning to be displayed after a group has been created, because we do a synchronous redirect viawindow.location.href = ...
as part of the form'sonSubmit
.The same callback also updates a piece of state that should avoid that warning, but the state is not synced in time.
This PR avoids a synchronous redirect, and instead adds a second piece of state which holds the location to redirect to. Then using
useEffect
we do the redirection once that state has been set.