Skip to content

Commit

Permalink
Distraction Free: Fix conflict with showListViewByDefault preference (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Jul 25, 2023
1 parent 75638ad commit 5582673
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export function initializeEditor(
dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();

// Check if the block list view should be open by default.
if ( select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) ) {
// If `distractionFree` mode is enabled, the block list view should not be open.
if (
select( editPostStore ).isFeatureActive( 'showListViewByDefault' ) &&
! select( editPostStore ).isFeatureActive( 'distractionFree' )
) {
dispatch( editPostStore ).setIsListViewOpened( true );
}

Expand Down
6 changes: 5 additions & 1 deletion packages/edit-site/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ export const setCanvasMode =
mode,
} );
// Check if the block list view should be open by default.
// If `distractionFree` mode is enabled, the block list view should not be open.
if (
mode === 'edit' &&
registry
.select( preferencesStore )
.get( 'core/edit-site', 'showListViewByDefault' )
.get( 'core/edit-site', 'showListViewByDefault' ) &&
! registry
.select( preferencesStore )
.get( 'core/edit-site', 'distractionFree' )
) {
dispatch.setIsListViewOpened( true );
}
Expand Down

1 comment on commit 5582673

@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 5582673.
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/5652923940
📝 Reported issues:

Please sign in to comment.