diff --git a/app/components/chat/Chat.client.tsx b/app/components/chat/Chat.client.tsx index 908c392..b783482 100644 --- a/app/components/chat/Chat.client.tsx +++ b/app/components/chat/Chat.client.tsx @@ -35,6 +35,9 @@ export function Chat() { const { ready, initialMessages, storeMessageHistory, importChat, exportChat } = useChatHistory(); const title = useStore(description); + useEffect(() => { + workbenchStore.setReloadedMessages(initialMessages.map((m) => m.id)); + }, [initialMessages]); return ( <> diff --git a/app/lib/stores/workbench.ts b/app/lib/stores/workbench.ts index 0337e23..92c3508 100644 --- a/app/lib/stores/workbench.ts +++ b/app/lib/stores/workbench.ts @@ -39,6 +39,8 @@ export class WorkbenchStore { #editorStore = new EditorStore(this.#filesStore); #terminalStore = new TerminalStore(webcontainer); + #reloadedMessages = new Set(); + artifacts: Artifacts = import.meta.hot?.data.artifacts ?? map({}); showWorkbench: WritableAtom = import.meta.hot?.data.showWorkbench ?? atom(false); @@ -243,6 +245,10 @@ export class WorkbenchStore { // TODO: what do we wanna do and how do we wanna recover from this? } + setReloadedMessages(messages: string[]) { + this.#reloadedMessages = new Set(messages); + } + addArtifact({ messageId, title, id, type }: ArtifactCallbackData) { const artifact = this.#getArtifact(messageId); @@ -262,7 +268,13 @@ export class WorkbenchStore { runner: new ActionRunner( webcontainer, () => this.boltTerminal, - (alert) => this.actionAlert.set(alert), + (alert) => { + if (this.#reloadedMessages.has(messageId)) { + return; + } + + this.actionAlert.set(alert); + }, ), }); }