useRelation: Update tests

This commit is contained in:
Gustav Hansen 2022-09-13 13:51:53 +02:00
parent 29e2e43132
commit 0fb9a7f525
2 changed files with 2 additions and 1 deletions

View File

@ -35,6 +35,7 @@ function setup(name = 'test', args) {
() => () =>
useRelation(name, { useRelation(name, {
relation: { relation: {
enabled: true,
endpoint: '/', endpoint: '/',
pageParams: { pageParams: {
limit: 10, limit: 10,

View File

@ -38,7 +38,7 @@ export const useRelation = (cacheKey, { relation, search }) => {
}; };
const relationsRes = useInfiniteQuery(['relation', cacheKey], fetchRelations, { const relationsRes = useInfiniteQuery(['relation', cacheKey], fetchRelations, {
enabled: !!relation?.enabled ?? true, enabled: relation.enabled,
getNextPageParam(lastPage) { getNextPageParam(lastPage) {
// the API may send an empty 204 response // the API may send an empty 204 response
if (!lastPage || lastPage.pagination.page >= lastPage.pagination.pageCount) { if (!lastPage || lastPage.pagination.page >= lastPage.pagination.pageCount) {