diff --git a/package.json b/package.json index c5cd5ca..fd3c998 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "genui-widget", - "version": "0.6.1", + "version": "0.6.2", "type": "module", "description": "An embeddable chat widget that lets your AI chatbots render rich, interactive UI like buttons, forms, charts, cards and more instead of plain text. Works out of the box with LangGraph/LangChain and n8n.", "main": "./dist/genui-widget.umd.js", diff --git a/src/index.ts b/src/index.ts index 686e7cf..926a50e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -371,8 +371,10 @@ export function createChat(config: ChatConfig): ChatInstance { }, destroy: () => { + if (!container.isConnected) return; // Already destroyed root.unmount(); container.remove(); + delete window.__THESYS_CHAT__; }, getSessionId: () => currentSessionId || "",