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:
@@ -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 (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user