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

Site Editor: Navigator's goTo function called twice when navigating screens in the sidebar #51760

Open
ciampo opened this issue Jun 21, 2023 · 1 comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Package] Edit Site /packages/edit-site [Type] Bug An existing feature does not function as intended

Comments

@ciampo
Copy link
Contributor

ciampo commented Jun 21, 2023

When interacting with the sidebar in the site editor, clicking buttons to navigate to a new screen seems to call the underlying goTo function twice:

  • one call is triggered (correctly) by NavigatorButton, used to render those buttons
  • one extra call seems to be triggered by the useSyncPathWithURL hook, in particular by this line of code

Calling goTo twice can prevent Navigator from working as expected — for example, when navigating to the previous/parent screen, the focus is currently not being restored correctly on the button that triggered the previous navigation

cc @youknowriad

@ciampo ciampo added [Type] Bug An existing feature does not function as intended [Package] Edit Site /packages/edit-site [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jun 21, 2023
@youknowriad
Copy link
Contributor

one extra call seems to be triggered by the useSyncPathWithURL hook, in particular by this line of code

This is something I'd like to remove by making the Navigator component controlled. Otherwise, it's very hard to address all the edge cases in these two-way synchronization and React effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Package] Edit Site /packages/edit-site [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants