File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
packages/@headlessui-vue/src/hooks Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
19
19
- Stop the event from propagating in the ` Popover ` component ([ #798 ] ( https://github.com/tailwindlabs/headlessui/pull/798 ) )
20
20
- Allow to click on elements inside a ` DialogOverlay ` ([ #816 ] ( https://github.com/tailwindlabs/headlessui/pull/816 ) )
21
+ - Fix SSR crash because of ` useWindowEvent ` ([ #817 ] ( https://github.com/tailwindlabs/headlessui/pull/817 ) )
21
22
22
23
## [ @headlessui/react @v1.4.1] - 2021-08-30
23
24
Original file line number Diff line number Diff line change 1
- import { onUnmounted } from 'vue'
1
+ import { watchEffect } from 'vue'
2
2
3
3
export function useWindowEvent < TType extends keyof WindowEventMap > (
4
4
type : TType ,
5
5
listener : ( this : Window , ev : WindowEventMap [ TType ] ) => any ,
6
6
options ?: boolean | AddEventListenerOptions
7
7
) {
8
- window . addEventListener ( type , listener , options )
9
- onUnmounted ( ( ) => window . removeEventListener ( type , listener , options ) )
8
+ watchEffect ( onInvalidate => {
9
+ window . addEventListener ( type , listener , options )
10
+
11
+ onInvalidate ( ( ) => {
12
+ window . removeEventListener ( type , listener , options )
13
+ } )
14
+ } )
10
15
}
You can’t perform that action at this time.
0 commit comments