Skip to content

Commit 3fd734f

Browse files
anaisbergSimonClo
authored andcommitted
♻️ use object to type function
1 parent 6afb6e1 commit 3fd734f

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/DatabaseBlock/DatabaseGrid.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ export const DatabaseGrid = ({
6666
cellRendererSelector: (
6767
params: ICellRendererParams<Record<string, string>>,
6868
) =>
69-
addRowCellRenderer(params, columnNames, setRowData, {
69+
addRowCellRenderer({
70+
params,
71+
columnNames,
72+
setRowData,
7073
documentId,
7174
tableId,
7275
}),
@@ -100,9 +103,12 @@ export const DatabaseGrid = ({
100103
cellRendererSelector: (
101104
params: ICellRendererParams<Record<string, string>>,
102105
) =>
103-
addRowCellRenderer(params, columnNames, setRowData, {
106+
addRowCellRenderer({
104107
documentId,
105108
tableId,
109+
params,
110+
columnNames,
111+
setRowData,
106112
}),
107113
};
108114

src/frontend/apps/impress/src/features/docs/doc-editor/components/custom-blocks/DatabaseBlock/utils.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,23 @@ export const createNewRow = ({
4040
return addNewRow;
4141
};
4242

43-
export const addRowCellRenderer = (
44-
params: ICellRendererParams<Record<string, string>>,
45-
columns: string[] | undefined,
46-
setRowData: Dispatch<SetStateAction<DatabaseRow[] | undefined>>,
47-
{
48-
documentId,
49-
tableId,
50-
}: {
51-
documentId: string;
52-
tableId: string;
53-
},
54-
) => {
43+
export const addRowCellRenderer = ({
44+
params,
45+
columnNames,
46+
setRowData,
47+
documentId,
48+
tableId,
49+
}: {
50+
params: ICellRendererParams<Record<string, string>>;
51+
columnNames: string[] | undefined;
52+
setRowData: Dispatch<SetStateAction<DatabaseRow[] | undefined>>;
53+
documentId: string;
54+
tableId: string;
55+
}) => {
5556
if (params.data) {
5657
const addRowButton = {
5758
component: AddRowButton,
58-
params: { columns, setRowData, documentId, tableId },
59+
params: { columns: columnNames, setRowData, documentId, tableId },
5960
};
6061
if (Object.values(params.data)[0] === ADD_NEW_ROW) {
6162
return addRowButton;

0 commit comments

Comments
 (0)