react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Upgrade `react-router` to 6.22.0, use data router, stabilize `useWarnWhenUnsavedChanges` and remove `<Admin history>` prop

Open slax57 opened this issue 1 year ago • 0 comments

Todo

  • [x] Upgrade react-router to 6.22.0
  • [x] Rewrite useWarnWhenUnsavedChanges to use useBlocker instead of UNSAFE_NavigationContext
  • [x] Use data router in the simple demo
  • [x] Test and compare with previous version of useWarnWhenUnsavedChanges
  • [x] Implement blocking when closing the browser tab
  • [x] Use data router in ra-core
  • [x] Remove (deprecated) history prop
  • [ ] Update all tests that use history
  • [ ] Provide a codemod
  • [ ] Clean up test code
  • [ ] Write the Upgrade guide

Technical notes

  • This new implementation no longer waits until the submission is complete before redirecting. Instead, it blocks navigation and opens the confirmation dialog if the form is currently submitting. While the dialog is open, submission continues in the background.
  • Implementing blocking when closing the browser tab now requires listening to the 'beforeunload' event. Modern browsers no longer allow to customize the message displayed in the confirmation dialog, so we can only display the default one.

slax57 avatar Feb 09 '24 16:02 slax57