Skip to content

Commit

Permalink
fix(react): 🐛 "Worker is not defined" error in Next.js SSR (#314)
Browse files Browse the repository at this point in the history
* fix(react): 🐛 "Worker is not defined" error in Next.js SSR

- Added `use client` directive to DotLottieReact component modules to
prevent server-side rendering of worker-related code.

✅ Closes: #311
  • Loading branch information
theashraf authored Aug 5, 2024
1 parent 4dcc772 commit 18f8015
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-jobs-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-react': patch
---

fix(react): 🐛 "Worker is not defined" error in Next.js SSR
2 changes: 2 additions & 0 deletions packages/react/src/dotlottie.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { DotLottie, Config } from '@lottiefiles/dotlottie-web';
import type { ComponentProps, RefCallback } from 'react';
import React from 'react';
Expand Down

0 comments on commit 18f8015

Please sign in to comment.