Commit de8ea591775f172eb6caa1ef72d827c903250f80

Authored by George Tan
Committed by GitHub
1 parent 1dc6faf3

fix(table component): reduce 'insertTableDataRecord' code logic (#1536)

src/components/Table/src/hooks/useDataSource.ts
... ... @@ -196,11 +196,10 @@ export function useDataSource(
196 196 }
197 197  
198 198 function insertTableDataRecord(record: Recordable, index: number): Recordable | undefined {
199   - if (!dataSourceRef.value || dataSourceRef.value.length == 0) return;
  199 + // if (!dataSourceRef.value || dataSourceRef.value.length == 0) return;
200 200 index = index ?? dataSourceRef.value?.length;
201 201 unref(dataSourceRef).splice(index, 0, record);
202   - unref(propsRef).dataSource?.splice(index, 0, record);
203   - return unref(propsRef).dataSource;
  202 + return unref(dataSourceRef);
204 203 }
205 204  
206 205 function findTableDataRecord(rowKey: string | number) {
... ...