Skip to content

Commit

Permalink
fix(nextjs): fix SSR issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZL-Asica committed Nov 30, 2024
1 parent 431add5 commit 914fcfb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @zl-asica/react

## 0.3.9

### Patch Changes

- Fix nextjs issue in SSR

## 0.3.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/hooks/dom/useEventListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 914fcfb

Please sign in to comment.