mirror of
https://github.com/strapi/strapi.git
synced 2025-08-08 08:46:42 +00:00
useRelation: Update tests
This commit is contained in:
parent
29e2e43132
commit
0fb9a7f525
@ -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,
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user