Fix token expiration error loop (#6731) (#8802)

Fixes issue https://github.com/twentyhq/twenty/issues/6731

**Problem:** After access token token expires, scrolling down the
`RecordTable` component will put it to an infinite loop of trying to
fetch records and printing errors on every iteration.

**Solution:** Disable fetching until component remount if a `FORBIDDEN`
error is encountered.

---------

Co-authored-by: ad-elias <elias@autodiligence.com>
This commit is contained in:
eliasylonen
2024-11-29 10:59:19 +01:00
committed by GitHub
parent 83223eeae3
commit c878f09d72
3 changed files with 34 additions and 3 deletions

View File

@ -188,6 +188,7 @@ export const useFetchMoreRecordsWithPagination = <
};
} catch (error) {
handleFindManyRecordsError(error as ApolloError);
return { error: error as ApolloError };
} finally {
setIsFetchingMoreObjects(false);
}