Currently, when toggling the display state of Collapse, the child components are being destroyed, and each time the collapse is displayed, the child components are re-rendered. This results in unnecessary performance overhead, especially when there are many fields.
The child elements of Collapse will be rendered only when the Collapse is first opened, and they won't be destroyed when the Collapse is closed, thus avoiding re-rendering when it's opened again.
Currently, when toggling the display state of Collapse, the child components are being destroyed, and each time the collapse is displayed, the child components are re-rendered. This results in unnecessary performance overhead, especially when there are many fields.
Before
https://github.com/drawdb-io/drawdb/assets/48666585/f02c4827-943d-4529-8177-c7653994526d
We can optimize this by using the keepDOM and lazyRender properties of Collapse:
After
https://github.com/drawdb-io/drawdb/assets/48666585/9b58bc67-2cb3-401d-870d-89dbd4b1bad6
The child elements of Collapse will be rendered only when the Collapse is first opened, and they won't be destroyed when the Collapse is closed, thus avoiding re-rendering when it's opened again.