From 25b39587e53f5df6997fc5e494c7aeba1cd8c71d Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Wed, 7 Aug 2024 13:29:28 -0400 Subject: [PATCH 1/2] Whitespace clean up. --- src/components/multiple-post-select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/multiple-post-select.js b/src/components/multiple-post-select.js index 9811c4e..3dbc4b7 100644 --- a/src/components/multiple-post-select.js +++ b/src/components/multiple-post-select.js @@ -12,7 +12,7 @@ export const MultiplePostSelect = ( { attributes, setAttributes } ) => { const postTypes = useSelect( ( select ) => select( coreStore ) - .getPostTypes({ per_page: 50 }) + .getPostTypes( { per_page: 50 } ) ?.filter( ( { viewable } ) => viewable ) ?.map( ( { slug } ) => slug ) ); From 1277fe95e5472bb090a15b9fb2e61889c9736859 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Wed, 7 Aug 2024 13:30:08 -0400 Subject: [PATCH 2/2] Trim title.rendered to ensure there are not false negatives due to leading/trailing whitespace. --- src/components/post-include-controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/post-include-controls.js b/src/components/post-include-controls.js index 4db2d7b..7b44e43 100644 --- a/src/components/post-include-controls.js +++ b/src/components/post-include-controls.js @@ -77,7 +77,7 @@ export const PostIncludeControls = ( { attributes, setAttributes } ) => { const getPostId = ( postTitle ) => { const foundPost = includePosts.find( ( post ) => post.title === postTitle ) || - posts.find( ( post ) => post.title.rendered === postTitle ); + posts.find( ( post ) => post.title.rendered.trim() === postTitle ); return foundPost.title.rendered ? { id: foundPost.id, title: foundPost.title.rendered }