8000 fix(useScroll): can not read properties of null (reading document) (#… · vueuse/vueuse@e97427f · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit e97427f

Browse files
lanxizhujoaopslins
andauthored
fix(useScroll): can not read properties of null (reading document) (#3544)
Co-authored-by: João Paulo Siqueira Lins <joaopslins@gmail.com>
1 parent 3d6b9c6 commit e97427f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/core/useScroll/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,11 @@ export function useScroll(
251251
)
252252

253253
tryOnMounted(() => {
254-
setArrivedState(toValue(element))
254+
const _element = toValue(element)
255+
if (!_element)
256+
return
257+
258+
setArrivedState(_element)
255259
})
256260

257261
useEventListener(

0 commit comments

Comments
 (0)
0