Skip to content

Commit 8628e3e

Browse files
committed
remove beforeunload event only when undoable is true
1 parent 2166223 commit 8628e3e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/ra-ui-materialui/src/layout/Notification.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ export const Notification = (props: NotificationProps) => {
6464
}
6565

6666
return () => {
67-
window.removeEventListener('beforeunload', beforeunload);
67+
if (messageInfo?.notificationOptions?.undoable) {
68+
window.removeEventListener('beforeunload', beforeunload);
69+
}
6870
};
6971
}, [notifications, messageInfo, open, takeNotification]);
7072

0 commit comments

Comments
 (0)