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

UI: Migrate router to react-router #16440

Merged
merged 14 commits into from
Oct 25, 2021
Merged

Conversation

ndelangen
Copy link
Member

Issue: #14619

What I did

I migrated storybook to use react-router v6 (seems to be in beta)

react-router: https://github.com/remix-run/react-router

I following this migration-guide:
https://github.com/remix-run/react-router/blob/main/docs/guides/migrating-reach-to-6.md

I took the minimal resistance path, meaning I have retained the Location component and how it works.
Even though this is NOT something react-router provides.
Instead react-router provides hooks and Route components, but retrieving the location has to be done using a hook.
I agree that this is a good change, and we should do it at some point, but baby-steps.
Let's provide the upgrade works, and then take further steps.

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@ndelangen ndelangen self-assigned this Oct 21, 2021
@ndelangen ndelangen added the maintenance User-facing maintenance tasks label Oct 21, 2021
# Conflicts:
#	lib/api/package.json
#	lib/router/package.json
#	yarn.lock
@nx-cloud
Copy link

nx-cloud bot commented Oct 21, 2021

Nx Cloud Report

CI ran the following commands for commit c325477. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

@ndelangen
Copy link
Member Author

I have some more work todo on making all stories pass that wanted the router with a mocked value

@ndelangen
Copy link
Member Author

hmm, the preview stories seem to still be missing some data from the manager state.

The app stories look like correct changes to me.

@shilman shilman changed the title migrate router to react-router UI: Migrate router to react-router Oct 23, 2021
@shilman
Copy link
Member

shilman commented Oct 23, 2021

Tried it out in the example projects and it's looking pretty great @ndelangen! If we can get those stories fixed, do you think it's safe to merge for 6.4?

@ndelangen
Copy link
Member Author

I find it hard to say, how safe it is to merge into 6.4. I'm 95% confident it should be fine tbh.

There could be complications if a user is using react-router and is mocking it or something. Then it might break in docs, maybe. Again it's hard to say.

I suspect the conflicts will be minimal, but if they happen the user can reach out to me, and if I get a repro I can debug.

@alvis
Copy link

alvis commented Oct 25, 2021

Thanks so much @ndelangen! When those stories are fixed, I'm happy to try on our private repo as a next release.
The earlier we put it into next, the more time the community can check if there's any issue with the changes.

@yannbf yannbf self-assigned this Oct 25, 2021
@yannbf
Copy link
Member

yannbf commented Oct 25, 2021

To test:

  • Navigate to story
  • Navigate to about page
  • Force reloading
  • Composition
  • Args change
    Args get completely reset when typing characters like @ or ?. I guess it makes sense as they are sanitized, but the entire arg is cleared from the URL and not just the special characters. Is this intended? I know it's not related to this PR though
  • Globals change

@shilman shilman added this to the 6.4 PRs milestone Oct 25, 2021
@shilman shilman merged commit 5bd73e2 into next Oct 25, 2021
@shilman shilman deleted the fix/14619-react-router-upgrade branch October 25, 2021 18:42
"core-js": "^3.8.2",
"fast-deep-equal": "^3.1.3",
"global": "^4.4.0",
"lodash": "^4.17.20",
"memoizerific": "^1.11.3",
"qs": "^6.10.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

tests are still using it, so it should stay in devDependencies

Copy link
Member

Choose a reason for hiding this comment

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

Any chance you can make a PR? 🙏

Copy link
Contributor

Choose a reason for hiding this comment

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

@shilman here you go: #16525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants