Skip to content

Commit

Permalink
fix(useEventListener): watch ref with flush: post, close #356
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 1, 2021
1 parent 5832f7b commit c52f70f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/useEventListener/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function useEventListener(...args: any[]) {
}

if (!target)
return
return noop

let cleanup = noop

Expand All @@ -111,7 +111,7 @@ export function useEventListener(...args: any[]) {
cleanup = noop
}
},
{ immediate: true },
{ immediate: true, flush: 'post' },
)

const stop = () => {
Expand Down

0 comments on commit c52f70f

Please sign in to comment.