codacus commited on
Commit
28f0c36
·
1 Parent(s): 975e7d8

ignored alert on project reload

Browse files
app/components/chat/Chat.client.tsx CHANGED
@@ -35,6 +35,9 @@ export function Chat() {
35
 
36
  const { ready, initialMessages, storeMessageHistory, importChat, exportChat } = useChatHistory();
37
  const title = useStore(description);
 
 
 
38
 
39
  return (
40
  <>
 
35
 
36
  const { ready, initialMessages, storeMessageHistory, importChat, exportChat } = useChatHistory();
37
  const title = useStore(description);
38
+ useEffect(() => {
39
+ workbenchStore.setReloadedMessages(initialMessages.map((m) => m.id));
40
+ }, [initialMessages]);
41
 
42
  return (
43
  <>
app/lib/stores/workbench.ts CHANGED
@@ -39,6 +39,8 @@ export class WorkbenchStore {
39
  #editorStore = new EditorStore(this.#filesStore);
40
  #terminalStore = new TerminalStore(webcontainer);
41
 
 
 
42
  artifacts: Artifacts = import.meta.hot?.data.artifacts ?? map({});
43
 
44
  showWorkbench: WritableAtom<boolean> = import.meta.hot?.data.showWorkbench ?? atom(false);
@@ -243,6 +245,10 @@ export class WorkbenchStore {
243
  // TODO: what do we wanna do and how do we wanna recover from this?
244
  }
245
 
 
 
 
 
246
  addArtifact({ messageId, title, id, type }: ArtifactCallbackData) {
247
  const artifact = this.#getArtifact(messageId);
248
 
@@ -262,7 +268,13 @@ export class WorkbenchStore {
262
  runner: new ActionRunner(
263
  webcontainer,
264
  () => this.boltTerminal,
265
- (alert) => this.actionAlert.set(alert),
 
 
 
 
 
 
266
  ),
267
  });
268
  }
 
39
  #editorStore = new EditorStore(this.#filesStore);
40
  #terminalStore = new TerminalStore(webcontainer);
41
 
42
+ #reloadedMessages = new Set<string>();
43
+
44
  artifacts: Artifacts = import.meta.hot?.data.artifacts ?? map({});
45
 
46
  showWorkbench: WritableAtom<boolean> = import.meta.hot?.data.showWorkbench ?? atom(false);
 
245
  // TODO: what do we wanna do and how do we wanna recover from this?
246
  }
247
 
248
+ setReloadedMessages(messages: string[]) {
249
+ this.#reloadedMessages = new Set(messages);
250
+ }
251
+
252
  addArtifact({ messageId, title, id, type }: ArtifactCallbackData) {
253
  const artifact = this.#getArtifact(messageId);
254
 
 
268
  runner: new ActionRunner(
269
  webcontainer,
270
  () => this.boltTerminal,
271
+ (alert) => {
272
+ if (this.#reloadedMessages.has(messageId)) {
273
+ return;
274
+ }
275
+
276
+ this.actionAlert.set(alert);
277
+ },
278
  ),
279
  });
280
  }