Skip to content

Commit

Permalink
Patterns: Fix setting of sync status for fully synced patterns (#51952)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored and tellthemachines committed Jul 3, 2023
1 parent 0702768 commit 70fda06
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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 @@ -154,7 +154,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

0 comments on commit 70fda06

Please sign in to comment.