mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
Merge pull request #1228 from iamanishroy/new-field-subtable-array
Bug Fix - could not find row
This commit is contained in:
@@ -72,7 +72,7 @@ export default function SideDrawerFields({ row }: ISideDrawerFieldsProps) {
|
||||
value,
|
||||
deleteField: undefined,
|
||||
arrayTableData: {
|
||||
index: selectedCell.arrayIndex ?? 0,
|
||||
index: selectedCell.arrayIndex,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export function useMenuAction(
|
||||
value: undefined,
|
||||
deleteField: true,
|
||||
arrayTableData: {
|
||||
index: selectedCell.arrayIndex ?? 0,
|
||||
index: selectedCell.arrayIndex,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -121,7 +121,7 @@ export function useMenuAction(
|
||||
fieldName: selectedCol.fieldName,
|
||||
value: parsed,
|
||||
arrayTableData: {
|
||||
index: selectedCell.arrayIndex ?? 0,
|
||||
index: selectedCell.arrayIndex,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -201,7 +201,7 @@ export function useFirestoreDocAsCollectionWithAtom<T = TableRow>(
|
||||
useEffect(() => {
|
||||
if (deleteDocAtom) {
|
||||
setDeleteRowAtom(() => (_: string, options?: ArrayTableRowData) => {
|
||||
if (!options) return;
|
||||
if (!options || !options.index) return;
|
||||
const updateFunction = deleteRow(options.index);
|
||||
return setRows(updateFunction);
|
||||
});
|
||||
@@ -231,11 +231,15 @@ export function useFirestoreDocAsCollectionWithAtom<T = TableRow>(
|
||||
if (options === undefined) return;
|
||||
|
||||
const deleteRowFields = () => {
|
||||
if (options.index === undefined) return;
|
||||
|
||||
const updateFunction = deleteField(options.index, deleteFields);
|
||||
return setRows(updateFunction);
|
||||
};
|
||||
|
||||
const updateRowValues = () => {
|
||||
if (options.index === undefined) return;
|
||||
|
||||
const updateFunction = updateTable(options.index, update);
|
||||
return setRows(updateFunction);
|
||||
};
|
||||
|
||||
2
src/types/table.d.ts
vendored
2
src/types/table.d.ts
vendored
@@ -212,7 +212,7 @@ export type TableSort = {
|
||||
};
|
||||
|
||||
export type ArrayTableRowData = {
|
||||
index: number;
|
||||
index?: number;
|
||||
parentField?: string;
|
||||
operation?: ArrayTableOperations;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user