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
eastern-cyanOP•5mo 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
fair-rose•3w ago
same question here, I want to align the behavior to block nav for reload/go back/redirect tho
extended-salmon•3w ago
Yeah,
useBlocker
hook 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.