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

Patterns: Fix setting of sync status for fully synced patterns #51952

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export default function CreatePatternModal( {
title: name || __( 'Untitled Pattern' ),
content: '',
status: 'publish',
meta: { sync_status: syncType },
meta:
syncType === SYNC_TYPES.unsynced
? { sync_status: syncType }
: undefined,
},
{ throwOnError: true }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const reusableBlockToPattern = ( reusableBlock ) => ( {
categories: reusableBlock.wp_pattern,
id: reusableBlock.id,
name: reusableBlock.slug,
syncStatus: reusableBlock.meta?.sync_status,
syncStatus: reusableBlock.meta?.sync_status || SYNC_TYPES.full,
title: reusableBlock.title.raw,
type: reusableBlock.type,
reusableBlock,
Expand Down
7 changes: 2 additions & 5 deletions packages/editor/src/components/post-sync-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ export default function PostSyncStatus() {
editPost( {
meta: {
...meta,
wp_block:
syncStatus === 'unsynced'
? { sync_status: syncStatus }
: null,
sync_status: syncStatus === 'unsynced' ? syncStatus : null,
},
} );
const syncStatus = meta?.wp_block?.sync_status;
const syncStatus = meta?.sync_status;
const isFullySynced = ! syncStatus;

return (
Expand Down