Skip to content

Commit

Permalink
Do not load more if error
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Trompette committed May 21, 2024
1 parent d9012d6 commit ac9fac4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const useFindManyRecords = <T extends ObjectRecord = ObjectRecord>({

const fetchMoreRecords = useCallback(async () => {
// Remote objects does not support hasNextPage. We cannot rely on it to fetch more records.
if (hasNextPage || !isAggregationEnabled(objectMetadataItem)) {
if (hasNextPage || (!isAggregationEnabled(objectMetadataItem) && !error)) {
setIsFetchingMoreObjects(true);

try {
Expand Down Expand Up @@ -202,6 +202,7 @@ export const useFindManyRecords = <T extends ObjectRecord = ObjectRecord>({
}, [
hasNextPage,
objectMetadataItem,
error,
setIsFetchingMoreObjects,
fetchMore,
filter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { ViewPickerListContent } from '@/views/view-picker/components/ViewPicker
import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId';
import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode';
import { useViewPickerPersistView } from '@/views/view-picker/hooks/useViewPickerPersistView';
import { isDefined } from '~/utils/isDefined';

import { useViewStates } from '../../hooks/internal/useViewStates';
import { isDefined } from '~/utils/isDefined';

const StyledDropdownLabelAdornments = styled.span`
align-items: center;
Expand Down

0 comments on commit ac9fac4

Please sign in to comment.