Fixed selection reset on loading more (#3500)

This commit is contained in:
Lucas Bordeau
2024-01-17 15:59:55 +01:00
committed by GitHub
parent adfd1f655d
commit 4fa9e18920

View File

@ -2,7 +2,6 @@ import { useRecoilCallback } from 'recoil';
import { entityFieldsFamilyState } from '@/object-record/field/states/entityFieldsFamilyState'; import { entityFieldsFamilyState } from '@/object-record/field/states/entityFieldsFamilyState';
import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates'; import { useRecordTableStates } from '@/object-record/record-table/hooks/internal/useRecordTableStates';
import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection';
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue'; import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
@ -15,8 +14,6 @@ export const useSetRecordTableData = ({
recordTableId, recordTableId,
onEntityCountChange, onEntityCountChange,
}: useSetRecordTableDataProps) => { }: useSetRecordTableDataProps) => {
const resetTableRowSelection = useResetTableRowSelection(recordTableId);
const { getTableRowIdsState, getNumberOfTableRowsState } = const { getTableRowIdsState, getNumberOfTableRowsState } =
useRecordTableStates(recordTableId); useRecordTableStates(recordTableId);
@ -41,16 +38,9 @@ export const useSetRecordTableData = ({
set(getTableRowIdsState(), entityIds); set(getTableRowIdsState(), entityIds);
} }
resetTableRowSelection();
set(getNumberOfTableRowsState(), entityIds.length); set(getNumberOfTableRowsState(), entityIds.length);
onEntityCountChange(entityIds.length); onEntityCountChange(entityIds.length);
}, },
[ [getNumberOfTableRowsState, getTableRowIdsState, onEntityCountChange],
getNumberOfTableRowsState,
getTableRowIdsState,
onEntityCountChange,
resetTableRowSelection,
],
); );
}; };