fix(chat): ensure artifact actions are correctly evaluated for completion

The dependency array in the Artifact component was missing `artifact.type` and `allActionFinished`, which could lead to incorrect evaluation of action completion. Additionally, the logic for determining if all actions are finished was updated to account for 'start' actions that are 'running'. This ensures that the component accurately reflects the state of bundled artifacts.
This commit is contained in:
KevIsDev
2025-04-28 14:34:07 +01:00
parent cfbc215001
commit 902166efee
2 changed files with 5 additions and 3 deletions

View File

@@ -54,13 +54,15 @@ export const Artifact = memo(({ messageId }: ArtifactProps) => {
}
if (actions.length !== 0 && artifact.type === 'bundled') {
const finished = !actions.find((action) => action.status !== 'complete');
const finished = !actions.find(
(action) => action.status !== 'complete' && !(action.type === 'start' && action.status === 'running'),
);
if (allActionFinished !== finished) {
setAllActionFinished(finished);
}
}
}, [actions]);
}, [actions, artifact.type, allActionFinished]);
return (
<>