Closed torkelo closed 3 months ago
Hi Torkel! I think you may have added me as a reviewer by mistake. I am a backend developer and cannot help here. Sorry for the late notice.
~@torkelo I think I found a regression in the core Grafana. Navigating to dashboard settings does not work. Url is updated correctly, hovewer the settings view is not shown. It does work tho when the page is refreshed. The same problem appears when trying to navigate to panel edit. Url update, no effect in the ui unless refreshed.~
~Moreover, navigating between settings pages does not work, and back/forward browser actions.~
My bad, tested agains a wrong branch.
:rocket: PR was released in v5.0.0
:rocket:
To me merged after main scenes-react PR is merged, https://github.com/grafana/scenes/pull/734
This is not easy but I think I found a pretty good solution to some very tricky problems
Problems solved
useLocation
is much better as this way we do not get location update event when moving to a different route / page so we always know if a location change is relevant for the current scene or not.Breaking changes
TODO
Release notes
EmbbedScene
no longer has a function namedinitUrlSync
as URL sync is now initialized via a hook exported from@grafana/scenes
calleduseUrlSync
. So to use EmbeddedScene in isolation (outside aSceneAppPage
) you need to initialize URL sync yourself.A simpler way to do the above is to use the new component,
UrlSyncContextProvider
that is exported from the main scenes lib:This is only if you are using
EmbeddedScene
in isolation, if you are usingEmbeddedScene
as part of aSceneAppPage
this is all handled for you by the default rendering ofSceneAppPage
so this change should not impactSceneAppPage
usage. If trying out the the newscenes-react
library the SceneContextProvider will make sure the root SceneContext is wrapped in anUrlSyncContextProvider
.📦 Published PR as canary version:
4.29.1--canary.765.9462062093.0
:sparkles: Test out this PR locally via: ```bash npm install @grafana/scenes-react@4.29.1--canary.765.9462062093.0 npm install @grafana/scenes@4.29.1--canary.765.9462062093.0 # or yarn add @grafana/scenes-react@4.29.1--canary.765.9462062093.0 yarn add @grafana/scenes@4.29.1--canary.765.9462062093.0 ```