Skip to content

Commit 6796769

Browse files
committed
check if server in controller verification
1 parent e06ce45 commit 6796769

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/Parallax/hooks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { useEffect } from 'react';
33

44
export function useVerifyController(controller: ParallaxController) {
55
useEffect(() => {
6+
const isServer = typeof window === 'undefined';
67
// Make sure the provided controller is an instance of the Parallax Controller
78
const isInstance = controller instanceof ParallaxController;
89
// Throw if neither context or global is available
9-
if (!controller && !isInstance) {
10+
if (!isServer && !controller && !isInstance) {
1011
throw new Error(
1112
"Must wrap your application's <Parallax /> components in a <ParallaxProvider />."
1213
);

0 commit comments

Comments
 (0)