* Remove unused components * Fix company not being created issue * Fix company not being created issue * Fix company not being created issue * Optimize rendering * Optimize rendering
18 lines
442 B
TypeScript
18 lines
442 B
TypeScript
import { useRecoilCallback } from 'recoil';
|
|
|
|
import { tableRowIdsState } from '../states/tableRowIdsState';
|
|
|
|
export function useUpsertTableRowId() {
|
|
return useRecoilCallback(
|
|
({ set, snapshot }) =>
|
|
(rowId: string) => {
|
|
const currentRowIds = snapshot
|
|
.getLoadable(tableRowIdsState)
|
|
.valueOrThrow();
|
|
|
|
set(tableRowIdsState, Array.from(new Set([...currentRowIds, rowId])));
|
|
},
|
|
[],
|
|
);
|
|
}
|