From 81ddf497dcc058f32d3ff08de48aebf2fe1bcf99 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 11 Jul 2023 14:00:12 +1200 Subject: [PATCH] Simplify the sync status so undefined always = synced --- .../editor/src/components/post-sync-status/index.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/components/post-sync-status/index.js b/packages/editor/src/components/post-sync-status/index.js index 7ad33862b36264..b3e36431fdd0ce 100644 --- a/packages/editor/src/components/post-sync-status/index.js +++ b/packages/editor/src/components/post-sync-status/index.js @@ -51,7 +51,7 @@ export default function PostSyncStatus() { export function PostSyncStatusModal() { const { editPost } = useDispatch( editorStore ); const [ isModalOpen, setIsModalOpen ] = useState( false ); - const [ syncType, setSyncType ] = useState( 'fully' ); + const [ syncType, setSyncType ] = useState( undefined ); const { postType, isNewPost } = useSelect( ( select ) => { const { getEditedPostAttribute, isCleanNewPost } = @@ -73,8 +73,7 @@ export function PostSyncStatusModal() { const setSyncStatus = () => { editPost( { meta: { - wp_pattern_sync_status: - syncType === 'unsynced' ? 'unsynced' : undefined, + wp_pattern_sync_status: syncType, }, } ); }; @@ -107,12 +106,10 @@ export function PostSyncStatusModal() { help={ __( 'Editing the pattern will update it anywhere it is used.' ) } - checked={ syncType === 'fully' } + checked={ ! syncType } onChange={ () => { setSyncType( - syncType === 'fully' - ? 'unsynced' - : 'fully' + ! syncType ? 'unsynced' : undefined ); } } />