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

chore: Upgrade react-router-dom and use-query-params to latest in /ui #4764

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

peruukki
Copy link
Contributor

@peruukki peruukki commented Nov 16, 2024

What this PR does / why we need it:

Upgrades react-router-dom and use-query-params to their latest versions; the latter is upgraded because its older version didn't work properly with the latest react-router-dom.

One small change in EuiCustomLink is done to avoid the error reported in #3794, I tried clicking everywhere in the UI and didn't see the error after the change.

Which issue(s) this PR fixes:

This allows to use the latest react-router-dom in a consuming app in case someone is using it, no longer being restricted to <6.4.0 due to #3794.

Misc

After the upgrade, react-router-dom writes a warning console message like this:

⚠️ React Router Future Flag Warning: Relative route resolution within Splat routes is changing in v7. You can use the v7_relativeSplatPath future flag to opt-in early. For more information, see https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath.

I tried enabling the flag but it caused issues with our current custom tab routes, and I couldn't sort it out with reasonable effort at this point. Also, since the feature can require non-trivial changes, enabling it might break something in consuming apps that use react-router-dom, so maybe better to leave it later anyway.

I enabled another future flag that I saw a similar console warning about, v7_startTransition, since that seems much safer, though I did need to add one await in the tests after that.

- hacks/RouteAdapter is no longer needed, the TypeScript types are nowadays
  correct

- Pass `to` directly to `useHref` to avoid errors with search params (see
  feast-dev#3794)

Signed-off-by: Harri Lehtola <[email protected]>
Updating query params when filtering table views somehow stopped working
after upgrading react-router-dom, upgrading use-query-params too fixes
that.

Signed-off-by: Harri Lehtola <[email protected]>
react-router-dom was writing warning messages in the console about
upcoming features in v7 and suggested opting in early. I tried turning
them on, but couldn't get custom tabs navigation working properly with
v7_relativeSplatPath enabled, so decided to keep it off for now. (Plus
it might also break something in consuming apps.)

v7_startTransition only needed an update in one place in a test where we
need to await for the UI to update, so kept it on. It also shouldn't
require any changes in consuming application code, though possibly
something in tests like we needed here.

Related docs:

- https://reactrouter.com/en/6.28.0/upgrading/future#v7_relativesplatpath

- https://reactrouter.com/en/6.28.0/upgrading/future#v7_starttransition

Signed-off-by: Harri Lehtola <[email protected]>
@peruukki peruukki requested a review from a team as a code owner November 16, 2024 13:40
@@ -39,7 +39,7 @@ export default function EuiCustomLink({ to, ...rest }) {
}

// Generate the correct link href (with basename accounted for)
const href = useHref({ pathname: to });
const href = useHref(to);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@peruukki peruukki changed the title chore: Upgrade react-router-dom and use-query-params to latest chore: Upgrade react-router-dom and use-query-params to latest in /ui Nov 16, 2024
@peruukki
Copy link
Contributor Author

Do we need a label from someone to run the last check, build-docker-image-java (feature-server-java)?

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

Successfully merging this pull request may close these issues.

2 participants