Skip to content

Commit

Permalink
Fix: DataViews: Layout resets for patterns each time a new pattern ca…
Browse files Browse the repository at this point in the history
…tegory is selected. (#63711)

* Fix: DataViews: Layout resets for patterns each time a new pattern category is selected.
* Use the state updater function

Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: mrfoxtalbot <[email protected]>
Co-authored-by: talldan <[email protected]>
  • Loading branch information
7 people authored Jul 19, 2024
1 parent 32b4b2e commit 3053d39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default function DataviewsPatterns() {
// Reset the page number when the category changes.
useEffect( () => {
if ( previousCategoryId !== categoryId ) {
setView( DEFAULT_VIEW );
setView( ( prevView ) => ( { ...prevView, page: 1 } ) );
}
}, [ categoryId, previousCategoryId ] );
const { data, paginationInfo } = useMemo( () => {
Expand Down

0 comments on commit 3053d39

Please sign in to comment.