Skip to content

Commit 7ced1bb

Browse files
committed
[ids] Reuse in React hook
1 parent ace6acc commit 7ced1bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ui-react/hooks.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,18 @@ export const useAddRowCallback: typeof useAddRowCallbackDecl = <Parameter>(
450450
storeOrStoreId?: StoreOrStoreId,
451451
then: (rowId: Id | undefined, store: Store, row: Row) => void = getUndefined,
452452
thenDeps: React.DependencyList = [],
453+
reuseRowIds = true,
453454
): ParameterizedCallback<Parameter> => {
454455
const store = useStoreOrStoreId(storeOrStoreId);
455456
return useCallback(
456457
(parameter) =>
457458
ifNotUndefined(store, (store) =>
458459
ifNotUndefined(getRow(parameter as any, store), (row: Row) =>
459-
then(store.addRow(tableId, row), store, row),
460+
then(store.addRow(tableId, row, reuseRowIds), store, row),
460461
),
461462
),
462463
// eslint-disable-next-line react-hooks/exhaustive-deps
463-
[store, tableId, ...getRowDeps, ...thenDeps],
464+
[store, tableId, ...getRowDeps, ...thenDeps, reuseRowIds],
464465
);
465466
};
466467

0 commit comments

Comments
 (0)