The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
bugfix: use row id instead of index to keep row selection after table… (#120)
Sammy Teillet2facb383a2bd
diff --git a/front/src/components/table/Table.tsx b/front/src/components/table/Table.tsxindex 62f7ced8c8c..1fbf0085b36 100644--- a/front/src/components/table/Table.tsx+++ b/front/src/components/table/Table.tsx@@ -124,6 +124,7 @@ const Table = <TData extends { id: string }, SortField>(getCoreRowModel: getCoreRowModel(),enableRowSelection: true,onRowSelectionChange: setInternalRowSelection,+ getRowId: (row) => row.id,});const selectedRows = table.getSelectedRowModel().rows;diff --git a/front/src/pages/people/People.tsx b/front/src/pages/people/People.tsxindex 3822a407d79..d6453dc5085 100644--- a/front/src/pages/people/People.tsx+++ b/front/src/pages/people/People.tsx@@ -63,7 +63,7 @@ function People() {}}, [loading, setInternalData, data]);- const addEmptyRow = useCallback(() => {+ const addEmptyRow = useCallback(async () => {const newCompany: Person = {id: uuidv4(),firstname: '',@@ -75,7 +75,7 @@ function People() {creationDate: new Date(),city: '',};- insertPerson(newCompany);+ await insertPerson(newCompany);setInternalData([newCompany, ...internalData]);refetch();}, [internalData, setInternalData, refetch]);