sshyam-gupta / react-router-prompt

A replacement component for the react-router 6 `Prompt`. Allows for more flexible dialogs.

Home Page:https://codesandbox.io/s/react-router-prompt-example-react-router-6-7-y9ug7z?file=/src/App.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug:使用浏览器的回退时,会优先执行children而不是when

Wang-yubo opened this issue · comments

详细描述一下,当我使用这个工具进行拦截路由跳转时,遇到浏览器回退和路由跳转不一样的效果。使用路由跳转时,先判断了when的条件,然后正常退出;但是用浏览器回退时并没有先判断条件,而是直接打开prompt组件又自己关闭了,但是页面却留在了当前页,再次点击浏览器回退时,才正常退出;
2081663758054_ pic

Thanks @Wang-yubo for creating the issue, but sorry I do not understand the language.
Would be great if you can update it in English.

English

If when() The settlement result of is flase, then use Browser's fallback button and use useNavgite The performance of exiting is inconsistent useNavgite Is ok, but use Browser's fallback button Will pop up first Modal, And the page remains in the current position, and then click Back for the second time to exit normally. I debugged it and found that it will not be executed first when The default isActive is true