-
Notifications
You must be signed in to change notification settings - Fork 27
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
Update to react-router@6
#979
base: main
Are you sure you want to change the base?
Conversation
Pushed an update to get SceneAppPage and most demos to work Scene apps needs a big update
|
<Route path={`${ROUTES.Demos}/*`} Component={DemoListPage} /> | ||
<Route path={`${ROUTES.GrafanaMonitoring}/*`} Component={GrafanaMonitoringApp} /> | ||
<Route path={`${ROUTES.ReactDemo}/*`} Component={ReactDemoPage} /> | ||
{/* <Redirect to={prefixRoute(ROUTES.Demos)} /> */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add a v6 redirect here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just make DemoListPage
a fallback page instead?
<Route path="*" Component={DemoListPage} />
e85e581
to
65f02c1
Compare
I have spent sometime trying to green out all the test case, and although I think got somewhere, there are some weird things that might need someone with deeper knowledge of the scenes projects. The main issue is with the tests under the scenes package: for some reason the inline @grafana/dashboards-squad |
77516f0
to
8ee5f00
Compare
@leventebalogh I see the tests are passing, did you find the issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @leventebalogh
How does this work for apps built with scenes that run in Grafana? Will they continue to work as long as they are built with an older version of scenes, or will they break when Grafana and scenes runs on router@v6?
Yes, thanks @oscarkilhed, we managed to green them out with @jackw 👍
I am currently testing out these changes with an example plugin, and as soon as I am done with that I'll update the PR description with correct instructions on what steps plugins need to take for updating. (We will probably also have a migration page for this) At the time being Grafana still supports plugins both using react-router@v5 or react-router@v6. This means, that plugins built with an earlier scenes version will still be supported (at least until core is updated to use react-router@v6 fully - then they will break). As far as I know scenes is bundled (and not externalised), so it shouldn't be a problem that core is depending on a different version (for now). I'll double check this though as well, and update the PR description! This must be major version bump though, as any plugins updating to this scenes version will also need to update some things in their source code. |
Fixes #608
Updates the scenes packages to use react-router v6.
This probably requires a major version bump, as it's going to be a breaking change for plugins that depend on scenes.
Why?
We are in the process of migrating Grafana core and also internal plugins to use react-router v6, however any plugin that is depending on scenes cannot easily do it (or at least it's a complicated task). Scenes still using react-router v5 is a blocker for plugins that would like to update.
Huge thanks to @jackw for the help of discovering and removing some of the circular dependences in the scenes package that were causing Jest to go mental.
Updating a plugin
Example plugin update PR →
@grafana/scenes
react-router-dom
@types/react-router-dom
-"@types/react-router-dom": "^5.2.0",
<Route>
: use relative wildcard routes<Route>
: use theelement
prop<Switch>
: replace withRoutes
routePath
prop to each<SceneAppPage>
Testing
The following tests were done with a locally built Grafana and new plugin scaffolds.
📦 Published PR as canary version:
6.0.0--canary.979.12373078054.0
✨ Test out this PR locally via: