diff --git a/assistant/package.json b/assistant/package.json index 00e3e8c1..ccdbd7a6 100644 --- a/assistant/package.json +++ b/assistant/package.json @@ -1,6 +1,6 @@ { "name": "@petercatai/assistant", - "version": "1.0.12", + "version": "1.0.15", "description": "PeterCat Assistant Application", "module": "dist/esm/index.js", "types": "dist/esm/index.d.ts", diff --git a/assistant/src/Assistant/index.tsx b/assistant/src/Assistant/index.tsx index f0403717..a97d3f73 100644 --- a/assistant/src/Assistant/index.tsx +++ b/assistant/src/Assistant/index.tsx @@ -23,9 +23,6 @@ const Assistant = (props: AssistantProps) => { }; const startDrag = (e: { clientY: any; preventDefault: () => void }) => { - if (typeof document === 'undefined') { - return; - } const startY = e.clientY; const initBottom = position.bottom; @@ -46,6 +43,11 @@ const Assistant = (props: AssistantProps) => { e.preventDefault(); // Prevent text selection }; + useEffect(() => { + if (typeof window === 'undefined') { + return; + } + }, []); useEffect(() => { setChatVisible(isVisible); @@ -60,6 +62,9 @@ const Assistant = (props: AssistantProps) => { }, ); + if (typeof window === 'undefined') { + return; + } return (