Skip to content

Commit

Permalink
fix(use-image): image ReferenceError in SSR (#3993)
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong authored Nov 5, 2024
1 parent c0cc602 commit 98b13d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/wild-jobs-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/use-image": patch
---

fix Image ReferenceError in SSR
2 changes: 1 addition & 1 deletion packages/hooks/use-image/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function setImageAndGetInitialStatus(
if (!src) return "pending";
if (ignoreFallback) return "loaded";

const img = new Image();
const img = document.createElement("img");

img.src = src;
if (crossOrigin) img.crossOrigin = crossOrigin;
Expand Down

0 comments on commit 98b13d9

Please sign in to comment.