diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df97c4..021e3cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @zl-asica/react +## 0.3.9 + +### Patch Changes + +- Fix nextjs issue in SSR + ## 0.3.8 ### Patch Changes diff --git a/jsr.json b/jsr.json index a6c7cfc..ff9e6dc 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@zl-asica/react", - "version": "0.3.8", + "version": "0.3.9", "license": "MIT", "exports": "./src/index.ts", "importMap": "./import_map.json", diff --git a/package.json b/package.json index dbc2fd1..0edfb0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zl-asica/react", - "version": "0.3.8", + "version": "0.3.9", "description": "A library of reusable React hooks, components, and utilities built by ZL Asica.", "keywords": [ "react", diff --git a/src/hooks/dom/useEventListener.ts b/src/hooks/dom/useEventListener.ts index 8a953ba..c2ebe4f 100644 --- a/src/hooks/dom/useEventListener.ts +++ b/src/hooks/dom/useEventListener.ts @@ -95,6 +95,7 @@ export const useEventListener = < }, [debouncedHandler]); useEffect(() => { + if (typeof globalThis === 'undefined') return; const targetElement: T | Window = element?.current ?? window; if (!targetElement || !targetElement.addEventListener) return;