Skip to content

Commit

Permalink
wp_localize_script converts to string
Browse files Browse the repository at this point in the history
  • Loading branch information
mogmarsh committed Sep 4, 2024
1 parent 0cdc3bb commit 7ea7260
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions blocks/query/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface Window {
allowedPostTypes: Array<string>;
allowedTaxonomies: Array<string>;
parselyAvailable: string,
maxPosts: number,
maxPosts: string,
};
}

Expand Down Expand Up @@ -83,7 +83,7 @@ export default function Edit({
allowedPostTypes = [],
allowedTaxonomies = [],
parselyAvailable = 'false',
maxPosts = 10,
maxPosts = '10',
} = {},
} = (window as any as Window);

Expand All @@ -92,7 +92,7 @@ export default function Edit({
}

const maxNumberOfPosts = !maxNumberOfPostsAttr
|| maxNumberOfPostsAttr > maxPosts ? maxPosts : maxNumberOfPostsAttr;
|| maxNumberOfPostsAttr > parseInt(maxPosts, 10) ? parseInt(maxPosts, 10) : maxNumberOfPostsAttr; // eslint-disable-line max-len

const andOrOptions = [
{
Expand Down Expand Up @@ -278,6 +278,10 @@ export default function Edit({
});
};

if (numberOfPosts > maxNumberOfPosts) {
setNumberOfPosts(maxNumberOfPosts);
}

for (let i = 0; i < numberOfPosts; i += 1) {
if (!manualPosts[i]) {
manualPosts[i] = null; // eslint-disable-line no-param-reassign
Expand Down

0 comments on commit 7ea7260

Please sign in to comment.