Skip to content

Commit

Permalink
ignored alert on project reload
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodacus committed Dec 21, 2024
1 parent 975e7d8 commit 28f0c36
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/components/chat/Chat.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
Expand Down
14 changes: 13 additions & 1 deletion app/lib/stores/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export class WorkbenchStore {
#editorStore = new EditorStore(this.#filesStore);
#terminalStore = new TerminalStore(webcontainer);

#reloadedMessages = new Set<string>();

artifacts: Artifacts = import.meta.hot?.data.artifacts ?? map({});

showWorkbench: WritableAtom<boolean> = import.meta.hot?.data.showWorkbench ?? atom(false);
Expand Down Expand Up @@ -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);

Expand All @@ -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);
},
),
});
}
Expand Down

0 comments on commit 28f0c36

Please sign in to comment.