diff --git a/packages/core-data/src/queried-data/get-query-parts.js b/packages/core-data/src/queried-data/get-query-parts.js index 90ca024f80a41..b374465572866 100644 --- a/packages/core-data/src/queried-data/get-query-parts.js +++ b/packages/core-data/src/queried-data/get-query-parts.js @@ -80,6 +80,9 @@ export function getQueryParts( query ) { // Two requests with different include values cannot have same results. if ( key === 'include' ) { + if ( typeof value === 'number' ) { + value = value.toString(); + } parts.include = ( getNormalizedCommaSeparable( value ) ?? [] ).map( Number ); diff --git a/packages/core-data/src/queried-data/test/get-query-parts.js b/packages/core-data/src/queried-data/test/get-query-parts.js index b3ca692ad09f5..f355be21a439b 100644 --- a/packages/core-data/src/queried-data/test/get-query-parts.js +++ b/packages/core-data/src/queried-data/test/get-query-parts.js @@ -18,8 +18,12 @@ describe( 'getQueryParts', () => { } ); it( 'parses out `include` ID filtering', () => { + const first = getQueryParts( { include: '1' } ); + const second = getQueryParts( { include: 1 } ); const parts = getQueryParts( { include: [ 1 ] } ); + expect( first ).toEqual( second ); + expect( second ).toEqual( parts ); expect( parts ).toEqual( { context: 'default', page: 1,