#2501·Chat2DB

bug(export): ExportProgressBar mutates store state during render

Author: Aias00Created Aug 4, 2026Updated Sep 9, 2026

Description

ExportProgressBar.contentRender mutates item.taskStatus (a zustand store state object) during render: if (item.taskStatus === FINISHED && item.errorLog) { item.taskStatus = ERROR; }. Mutating store state during render doesn't trigger re-render (it's an imperative mutation, not set), so the FINISHED→ERROR reclassification is inconsistent; it may also trigger React's "Cannot update a component while rendering" warning.

Location

chat2db-community-client/src/blocks/ImportAndExport/components/ExportProgressBar/index.tsx:59-61 (mutation), :74,79,84 (reads of item.taskStatus).

Impact

Finished tasks with errors may display incorrect status; React state inconsistency; potential console warning.

Suggested fix

Compute effectiveStatus without mutating: const effectiveStatus = (item.taskStatus === FINISHED && item.errorLog) ? ERROR : item.taskStatus; and use it in the render conditions.

Related existing

None.