Skip to content

Commit

Permalink
Only redirect to root when opening the style book on the revisions sc…
Browse files Browse the repository at this point in the history
…reen
  • Loading branch information
andrewserong committed Jun 6, 2023
1 parent 51e26bc commit 8ae9c7a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function GlobalStylesBlockLink() {
}

function GlobalStylesEditorCanvasContainerLink() {
const { goTo } = useNavigator();
const { goTo, location } = useNavigator();
const editorCanvasContainerView = useSelect(
( select ) =>
unlock( select( editSiteStore ) ).getEditorCanvasContainerView(),
Expand All @@ -253,12 +253,15 @@ function GlobalStylesEditorCanvasContainerLink() {
// Switching to the revisions container view should
// redirect to the revisions screen.
goTo( '/revisions' );
} else if ( editorCanvasContainerView === 'style-book' ) {
} else if (
editorCanvasContainerView === 'style-book' &&
location?.path === '/revisions'
) {
// Switching to the style book container view should
// redirect to the style book screen.
goTo( '/' );
}
}, [ editorCanvasContainerView, goTo ] );
}, [ editorCanvasContainerView, location?.path, goTo ] );
}

function GlobalStylesUI() {
Expand Down

0 comments on commit 8ae9c7a

Please sign in to comment.