Skip to content

Commit ad2b288

Browse files
authored
Add meta handling for infinite queries (#4939)
1 parent 78833cb commit ad2b288

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/toolkit/src/query/core/buildThunks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ export function buildThunks<
553553
pages: addTo(data.pages, pageResponse.data, maxPages),
554554
pageParams: addTo(data.pageParams, param, maxPages),
555555
},
556+
meta: pageResponse.meta,
556557
}
557558
}
558559

packages/toolkit/src/query/tests/infiniteQueries.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,15 +909,21 @@ describe('Infinite queries', () => {
909909
pages: [[{ id: '0', name: 'Pokemon 0' }]],
910910
pageParams: [0],
911911
},
912-
meta: undefined,
912+
meta: expect.objectContaining({
913+
request: expect.anything(),
914+
response: expect.anything(),
915+
}),
913916
})
914917

915918
expect(queryStartedCallback).toHaveBeenCalledWith('fire', {
916919
data: {
917920
pages: [[{ id: '0', name: 'Pokemon 0' }]],
918921
pageParams: [0],
919922
},
920-
meta: undefined,
923+
meta: expect.objectContaining({
924+
request: expect.anything(),
925+
response: expect.anything(),
926+
}),
921927
})
922928
})
923929

0 commit comments

Comments
 (0)