Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 33 commits into from
Feb 29, 2024

Conversation

slax57
Copy link
Contributor

@slax57 slax57 commented Feb 9, 2024

Todo

  • Upgrade react-router to 6.22.0
  • Rewrite useWarnWhenUnsavedChanges to use useBlocker instead of UNSAFE_NavigationContext
  • Use data router in the simple demo
  • Test and compare with previous version of useWarnWhenUnsavedChanges
  • Implement blocking when closing the browser tab
  • Use data router in ra-core
  • Remove (deprecated) history prop
  • Update all tests that use history
  • Provide a codemod
  • Clean up test code
  • Remove dependency on history
  • 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 slax57 added the WIP Work In Progress label Feb 9, 2024
@slax57 slax57 changed the title Upgrade react-router to 6.22.0, use data router and stabilize useWarnWhenUnsavedChanges Upgrade react-router to 6.22.0, use data router, stabilize useWarnWhenUnsavedChanges and remove <Admin history> prop Feb 21, 2024
@fzaninotto
Copy link
Member

needs rebase

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

46/114 files reviewed. So far, it's excellent, kudos!

docs/Upgrade.md Outdated Show resolved Hide resolved
docs/Upgrade.md Outdated Show resolved Hide resolved
examples/simple/src/index.tsx Outdated Show resolved Hide resolved
docs/Upgrade.md Show resolved Hide resolved
docs/Upgrade.md Show resolved Hide resolved
Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished my review. I only have a few questions and nitpicks. This PR is great!

By the way, you forgot one remaining MemoryRouter in BulkUpdateButton.stories.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants