Skip to content

Commit 9f638c9

Browse files
authored
fix: vue ssr (#867)
closes #840
1 parent fd9a2d2 commit 9f638c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/@headlessui-vue/src/hooks/use-window-event.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export function useWindowEvent<TType extends keyof WindowEventMap>(
55
listener: (this: Window, ev: WindowEventMap[TType]) => any,
66
options?: boolean | AddEventListenerOptions
77
) {
8+
if (typeof window === 'undefined') return
9+
810
watchEffect(onInvalidate => {
911
window.addEventListener(type, listener, options)
1012

0 commit comments

Comments
 (0)