bugfix: use row id instead of index to keep row selection after table… (#120)
* bugfix: use row id instead of index to keep row selection after table update * bugfix: await creation before displaying the row and refetching
This commit is contained in:
@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user