Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: pattern rendering issue #66022

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default function DataviewsPatterns() {
const categoryId = categoryIdFromURL || PATTERN_DEFAULT_CATEGORY;
const [ view, setView ] = useState( DEFAULT_VIEW );
const previousCategoryId = usePrevious( categoryId );
const previouspostType = usePrevious( type );
dhruvang21 marked this conversation as resolved.
Show resolved Hide resolved
ramonjd marked this conversation as resolved.
Show resolved Hide resolved
const viewSyncStatus = view.filters?.find(
( { field } ) => field === 'sync-status'
)?.value;
Expand Down Expand Up @@ -121,10 +122,10 @@ export default function DataviewsPatterns() {

// Reset the page number when the category changes.
useEffect( () => {
if ( previousCategoryId !== categoryId ) {
if ( previousCategoryId !== categoryId || previouspostType !== type ) {
ramonjd marked this conversation as resolved.
Show resolved Hide resolved
setView( ( prevView ) => ( { ...prevView, page: 1 } ) );
}
}, [ categoryId, previousCategoryId ] );
}, [ categoryId, previousCategoryId, previouspostType, type ] );
ramonjd marked this conversation as resolved.
Show resolved Hide resolved
const { data, paginationInfo } = useMemo( () => {
// Search is managed server-side as well as filters for patterns.
// However, the author filter in template parts is done client-side.
Expand Down
Loading