Skip to content

Commit

Permalink
Simplify the sync status so undefined always = synced
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Jul 11, 2023
1 parent 670079a commit 81ddf49
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/editor/src/components/post-sync-status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } =
Expand All @@ -73,8 +73,7 @@ export function PostSyncStatusModal() {
const setSyncStatus = () => {
editPost( {
meta: {
wp_pattern_sync_status:
syncType === 'unsynced' ? 'unsynced' : undefined,
wp_pattern_sync_status: syncType,
},
} );
};
Expand Down Expand Up @@ -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
);
} }
/>
Expand Down

0 comments on commit 81ddf49

Please sign in to comment.