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

fix(router): pass options on scoped router navigation #6923

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

rdunk
Copy link
Member

@rdunk rdunk commented Jun 13, 2024

Description

Scoped routers implement their own navigate function which wraps that of the parent router and calls it with some new resolved state.

Currently this wrapper function does not pass an options param to the parent function call. As far as I can tell this means scoped routers can only push, not replace history state. I suspect this is an oversight as for example the PaneRouter attempts to replace using an options param.

Similarly, in the Presentation tool, we can't currently replace history state as we implement our own scoped router (PresentationPaneRouterProvider), I believe this PR would fix that issue for us.

What to review

  1. Navigate to the test studio Structure tool root.
  2. Navigate to "Book".
  3. Create and publish a new "Book" document.
  4. Delete the document.
  5. Navigate back in your browser.

Before this PR:

You will navigate back to the deleted document. The code linked to above suggests this shouldn't be the case.

After this PR:

You will navigate back to the Structure tool root.

Testing

Notes for release

Pass navigation options when calling a scoped router's navigate function.

@rdunk rdunk requested a review from a team as a code owner June 13, 2024 09:25
@rdunk rdunk requested review from juice49 and removed request for a team June 13, 2024 09:25
Copy link

vercel bot commented Jun 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:25am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:25am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:25am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:25am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:25am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jun 13, 2024 9:25am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Jun 13, 2024 9:34 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 36s 3 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 14s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 6s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 29s 12 0 0

Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Thanks! Definitely looks like an oversight.

@rdunk rdunk added this pull request to the merge queue Jun 13, 2024
Merged via the queue into next with commit 77c4e86 Jun 13, 2024
45 checks passed
@rdunk rdunk deleted the fix/scoped-router-replace branch June 13, 2024 11:38
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