Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Antd table is not updating on dataSource updates/changes

Tags:

antd

<Table
     columns={columnsStructure}
     dataSource={source}
     pagination={pagination}
     onChange={handleChange}
/>

the source is an array of objects. On component mount Table is rendering properly but once datSource i.e. source is updated, table rows remain the same.

How to resolve this issue. Wanted to update ant design table on source update.

like image 499
Sumit Avatar asked Sep 16 '25 15:09

Sumit


1 Answers

To resolve this Ant-Design table data auto-update issue, you have to pass the data-source value as a clone of the observable value. like

<Table
     columns={columnsStructure}
     dataSource={[...source]}
     pagination={pagination}
     onChange={handleChange}
/>
like image 181
Sumit Avatar answered Sep 19 '25 06:09

Sumit