mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
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:
parent
cfbc215001
commit
902166efee
@ -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 (
|
||||
<>
|
||||
|
@ -131,7 +131,7 @@ export function useChatHistory() {
|
||||
|
||||
// Combine followup message and the artifact with files and command actions
|
||||
content: `Bolt Restored your chat from a snapshot. You can revert this message to load the full chat history.
|
||||
<boltArtifact id="restored-project-setup" title="Restored Project & Setup">
|
||||
<boltArtifact id="restored-project-setup" title="Restored Project & Setup" type="bundled">
|
||||
${Object.entries(snapshot?.files || {})
|
||||
.map(([key, value]) => {
|
||||
if (value?.type === 'file') {
|
||||
|
Loading…
Reference in New Issue
Block a user