Skip to content

Commit 216aab7

Browse files
committed
Revert "fix: do nothing when ref is null"
This reverts commit 491ae26.
1 parent 2f7639d commit 216aab7

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/hooks/useParallax.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export function useParallax<T extends HTMLElement>(props: ParallaxProps) {
2424
};
2525
newElement = controller?.createElement(options);
2626
setElement(newElement);
27-
} else if (ref.current === null) {
28-
// if the ref is null, do nothing
29-
return;
3027
} else {
3128
throw new Error(
3229
'You must assign the ref returned by the useParallax() hook to an HTML Element.'
@@ -38,7 +35,7 @@ export function useParallax<T extends HTMLElement>(props: ParallaxProps) {
3835
controller?.removeElementById(newElement.id);
3936
}
4037
};
41-
}, [ref.current]);
38+
}, []);
4239

4340
// update element
4441
useEffect(() => {

stories/Image/Image.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styles from './Image.module.scss';
55
export const Image = (props) => {
66
const parallaxController = useParallaxController();
77
function handleLoad() {
8-
parallaxController?.update();
8+
parallaxController.update();
99
}
1010
return (
1111
<div className={styles.image}>

0 commit comments

Comments
 (0)