Commit de8ea591775f172eb6caa1ef72d827c903250f80
Committed by
GitHub
1 parent
1dc6faf3
fix(table component): reduce 'insertTableDataRecord' code logic (#1536)
Showing
1 changed file
with
2 additions
and
3 deletions
src/components/Table/src/hooks/useDataSource.ts
@@ -196,11 +196,10 @@ export function useDataSource( | @@ -196,11 +196,10 @@ export function useDataSource( | ||
196 | } | 196 | } |
197 | 197 | ||
198 | function insertTableDataRecord(record: Recordable, index: number): Recordable | undefined { | 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 | index = index ?? dataSourceRef.value?.length; | 200 | index = index ?? dataSourceRef.value?.length; |
201 | unref(dataSourceRef).splice(index, 0, record); | 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 | function findTableDataRecord(rowKey: string | number) { | 205 | function findTableDataRecord(rowKey: string | number) { |