mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
doc: onNavigate follow-up (#77805)
Fix the logic when user explicitly wants to leave the page but navigation is blocked.
This commit is contained in:
@@ -1362,11 +1362,11 @@ export function CustomLink({ children, ...props }: CustomLinkProps) {
|
||||
return (
|
||||
<Link
|
||||
onNavigate={(e) => {
|
||||
if (isBlocked) {
|
||||
if (
|
||||
isBlocked &&
|
||||
!window.confirm('You have unsaved changes. Leave anyway?')
|
||||
) {
|
||||
e.preventDefault()
|
||||
if (!window.confirm('You have unsaved changes. Leave anyway?')) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
}}
|
||||
{...props}
|
||||
@@ -1389,11 +1389,11 @@ export function CustomLink({ children, ...props }) {
|
||||
return (
|
||||
<Link
|
||||
onNavigate={(e) => {
|
||||
if (isBlocked) {
|
||||
if (
|
||||
isBlocked &&
|
||||
!window.confirm('You have unsaved changes. Leave anyway?')
|
||||
) {
|
||||
e.preventDefault()
|
||||
if (!window.confirm('You have unsaved changes. Leave anyway?')) {
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
}}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user