T
TanStack11mo ago
conscious-sapphire

How to disable requests

{page: 0
size: 15
organizationId: 3
communityId: 167465
folderId: 36301
fromDate: 1681234061215
toDate: 1729180799999
includeDeleted: false}

const { state, setError, clearError, changeFilter } = useDocumentListState();

const { error } = state;

const filter = useRefCurrent(usePreparedDocumentFilterData(state.filter.toJS()));

const { isSecurityEnabled } = state.filter;

const { folderId, communityId, organizationId } = filter;
const {
sort,
fetch,
reset,
refresh,
isFetching,
pagination,
data: { data } = {},
} = useDocumentsQuery({ ...filter }, { onError: setError, staleTime: 0 });


const {
data,
reset,
error,
mutateAsync: _fetch,
isLoading: isFetching,
} = useMutation(
(o) =>
fetchFn({
...params,
name,
page,
...o,
...(sorting.field
? {
sort: `${sorting.field},${sorting.order}`,
}
: null),
}),
options,
);
{page: 0
size: 15
organizationId: 3
communityId: 167465
folderId: 36301
fromDate: 1681234061215
toDate: 1729180799999
includeDeleted: false}

const { state, setError, clearError, changeFilter } = useDocumentListState();

const { error } = state;

const filter = useRefCurrent(usePreparedDocumentFilterData(state.filter.toJS()));

const { isSecurityEnabled } = state.filter;

const { folderId, communityId, organizationId } = filter;
const {
sort,
fetch,
reset,
refresh,
isFetching,
pagination,
data: { data } = {},
} = useDocumentsQuery({ ...filter }, { onError: setError, staleTime: 0 });


const {
data,
reset,
error,
mutateAsync: _fetch,
isLoading: isFetching,
} = useMutation(
(o) =>
fetchFn({
...params,
name,
page,
...o,
...(sorting.field
? {
sort: `${sorting.field},${sorting.order}`,
}
: null),
}),
options,
);
When changing the community, the folderId is set to null, but the program executes an interface where only the communityId changes, and the folderId does not change. However, the folderId I printed after the change is always null. This interface will retry after an error, and it works correctly afterward, but the erroneous interface is intercepted by the system, resulting in a warning popup. How can I avoid this?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?