Skip to content

Commit

Permalink
fix(useIntervalFn): watch computed refs instead of just refs (#2539)
Browse files Browse the repository at this point in the history
  • Loading branch information
innocenzi committed Dec 16, 2022
1 parent 88b4419 commit 8bb7b50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/shared/useIntervalFn/index.ts
Expand Up @@ -2,7 +2,7 @@ import { isRef, ref, unref, watch } from 'vue-demi'
import { resolveUnref } from '../resolveUnref'
import { tryOnScopeDispose } from '../tryOnScopeDispose'
import type { Fn, MaybeComputedRef, Pausable } from '../utils'
import { isClient } from '../utils'
import { isClient, isFunction } from '../utils'

export interface UseIntervalFnOptions {
/**
Expand Down Expand Up @@ -61,7 +61,7 @@ export function useIntervalFn(cb: Fn, interval: MaybeComputedRef<number> = 1000,
if (immediate && isClient)
resume()

if (isRef(interval)) {
if (isRef(interval) || isFunction(interval)) {
const stopWatch = watch(interval, () => {
if (isActive.value && isClient)
resume()
Expand Down

0 comments on commit 8bb7b50

Please sign in to comment.