Skip to content

Commit 87cb731

Browse files
committed
do nothing when ref is null
1 parent a1a7f75 commit 87cb731

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/mui-material/src/useScrollTrigger/useScrollTrigger.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface UseScrollTriggerOptions {
22
disableHysteresis?: boolean;
3-
target?: Node | Window;
3+
target?: Node | Window | null;
44
threshold?: number;
55
}
66

packages/mui-material/src/useScrollTrigger/useScrollTrigger.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function useScrollTrigger(options = {}) {
2626
const store = React.useRef();
2727
const [trigger, setTrigger] = React.useState(() => getTrigger(store, other));
2828
React.useEffect(() => {
29+
if (target === null) return
2930
const handleScroll = () => {
3031
setTrigger(getTrigger(store, { target, ...other }));
3132
};

0 commit comments

Comments
 (0)