Skip to content

Commit

Permalink
Merge pull request #3727 from 10up/fix/post-type-settings-wasn't-resp…
Browse files Browse the repository at this point in the history
…ected

Fix: Post type setting wasn't respected during sync
  • Loading branch information
felipeelia committed Oct 27, 2023
2 parents 24b9576 + 1aceb99 commit 47b5da5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions assets/js/sync-ui/components/indexables.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export default () => {
indexables.splice(indexables.indexOf(indexable), 1);
}

const post_types = !indexables.length || indexables.includes('post') ? args.post_types : [];
const post_type = !indexables.length || indexables.includes('post') ? args.post_type : [];

setArgs({ ...args, indexables, post_types });
setArgs({ ...args, indexables, post_type });
};

return indexables.length > 1 ? (
Expand Down
12 changes: 6 additions & 6 deletions assets/js/sync-ui/components/post-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export default () => {
* @returns {void}
*/
const onChange = (postType, checked) => {
const post_types = [...args.post_types];
const post_type = [...args.post_type];

if (checked) {
post_types.push(postType);
post_type.push(postType);
} else {
post_types.splice(post_types.indexOf(postType), 1);
post_type.splice(post_type.indexOf(postType), 1);
}

setArgs({ ...args, post_types });
setArgs({ ...args, post_type });
};

return postTypes.length > 1 ? (
Expand All @@ -46,9 +46,9 @@ export default () => {
</legend>
{postTypes.map(([postType, label]) => (
<CheckboxControl
checked={args.post_types.includes(postType)}
checked={args.post_type.includes(postType)}
disabled={isSyncing}
indeterminate={!args.post_types.length}
indeterminate={!args.post_type.length}
key={postType}
label={label}
onChange={(checked) => onChange(postType, checked)}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/sync-ui/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const SyncSettingsProvider = ({ autoIndex, children, indexables, postType
lower_limit_object_id: null,
offset: 0,
put_mapping: false,
post_types: [],
post_type: [],
upper_limit_object_id: null,
});

Expand Down

0 comments on commit 47b5da5

Please sign in to comment.