Prevent useBlocker from showing alert on reload
im using useBlocker when i have a dialog open to make the back arrow instead going back in navigation closing the dialog, this works as expected but i dont want the alert on reload when the dialog its open, is there a way to prevent that but still make the back button close the dialog?

3 Replies
ratty-blushOP•8mo ago
also is there a better way to handle dialogs native of the router? i tried with history state but i ended up wiht a solution that added a lot of unnecesary entries to the history
adverse-sapphire•4mo ago
same question here, I want to align the behavior to block nav for reload/go back/redirect tho
flat-fuchsia•4mo ago
Yeah,
useBlockerhook recieves also enableBeforeUnload which can be a function that returns a boolean, or a boolean.
by defining it as false, it will remove this message.