Skip to content

Commit

Permalink
Global Style Revisions: ensure consistent back button behaviour (#55881)
Browse files Browse the repository at this point in the history
* When applying a revision the route should switch to the global styles panel. At the moment, it's using `goBack` which means the behaviour is inconsistent depending on the previous action.

* Update packages/edit-site/src/components/global-styles/screen-revisions/index.js

Co-authored-by: Andrew Serong <[email protected]>

* Update packages/edit-site/src/components/global-styles/screen-revisions/index.js

Co-authored-by: Andrew Serong <[email protected]>

---------

Co-authored-by: Andrew Serong <[email protected]>
  • Loading branch information
ramonjd and andrewserong committed Nov 8, 2023
1 parent 1b15cda commit cad8fae
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
);

function ScreenRevisions() {
const { goBack } = useNavigator();
const { goTo } = useNavigator();
const { user: userConfig, setUserConfig } =
useContext( GlobalStylesContext );
const { blocks, editorCanvasContainerView } = useSelect( ( select ) => {
Expand All @@ -58,13 +58,13 @@ function ScreenRevisions() {

useEffect( () => {
if ( editorCanvasContainerView !== 'global-styles-revisions' ) {
goBack();
goTo( '/' ); // Return to global styles main panel.
setEditorCanvasContainerView( editorCanvasContainerView );
}
}, [ editorCanvasContainerView ] );

const onCloseRevisions = () => {
goBack();
goTo( '/' ); // Return to global styles main panel.
};

const restoreRevision = ( revision ) => {
Expand Down

1 comment on commit cad8fae

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in cad8fae.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6793452692
📝 Reported issues:

Please sign in to comment.