Skip to content

Commit

Permalink
Pattern Explorer Modal: Select the first category as the initial cate…
Browse files Browse the repository at this point in the history
…gory (#47661)

* Pass the first pattern category as the initially selected category in the pattern explorer modal.

* If there is a selected category, make sure we use that instead.

* Update packages/block-editor/src/components/inserter/block-patterns-tab.js

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>

---------

Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
  • Loading branch information
apeatling and Mamaduka authored Feb 2, 2023
1 parent 5535a3a commit 53a4d51
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ function BlockPatternsTabs( {
} ) {
const [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );
const categories = usePatternsCategories( rootClientId );
const initialCategory = selectedCategory || categories[ 0 ];
const isMobile = useViewportMatch( 'medium', '<' );
return (
<>
Expand Down Expand Up @@ -261,7 +262,7 @@ function BlockPatternsTabs( {
) }
{ showPatternsExplorer && (
<PatternsExplorerModal
initialCategory={ selectedCategory }
initialCategory={ initialCategory }
patternCategories={ categories }
onModalClose={ () => setShowPatternsExplorer( false ) }
/>
Expand Down

1 comment on commit 53a4d51

@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 53a4d51.
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/4076582324
📝 Reported issues:

Please sign in to comment.