Router: Modify /share and /imagewizard routing

Insights offers 'quickstarts', which can be used to provide
mini-tutorials in a sidebar.

Unfortunately, these quickstarts change our URL... they add an optional
query parameter related to the quickstart. The process of doing so
destroys our router's `location`, setting it to undefined.

We have been using the location state to store the GUID of the image,
needed when opening the wizard via the `Recreate image` action or when
opening the share modal.

As a workaround, we can simply accept that the quickstarts will change
our URL and destroy our router's location. Instead, we now put the image
id (its UUID) in the route itself. We can access it in the components as
necessary via the useParams hook.
This commit is contained in:
lucasgarfield 2023-04-17 19:00:46 +02:00 committed by Lucas Garfield
parent a81fb72523
commit bc1435994d
12 changed files with 176 additions and 182 deletions

View file

@ -129,14 +129,7 @@ const ImageLinkDirect = ({ imageId, isExpired, isInClonesTable }) => {
component="a"
target="_blank"
variant="link"
onClick={() =>
navigate(resolveRelPath('imagewizard'), {
state: {
composeRequest: image.request,
initialStep: 'review',
},
})
}
onClick={() => navigate(resolveRelPath(`imagewizard/${imageId}`))}
isInline
>
Recreate image