Skip to content

Commit

Permalink
Handle both string and integer IDs properly
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Dec 20, 2022
1 parent 58a43de commit 26425eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core-data/src/queried-data/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ export function getMergedItemIds( itemIds, nextItemIds, page, perPage ) {
function removeEntitiesById( entities, ids ) {
return Object.fromEntries(
Object.entries( entities ).filter(
( [ id ] ) => ! ids.some( ( itemId ) => +itemId === +id )
( [ id ] ) =>
! ids.some( ( itemId ) => {
if ( Number.isInteger( itemId ) ) {
return itemId === +id;
}
return itemId === id;
} )
)
);
}
Expand Down

1 comment on commit 26425eb

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3740578998
📝 Reported issues:

Please sign in to comment.