PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: Kong/swrv (ts)

Issue:
refreshInterval is being swallowed by clearTimeout
refreshInterval seems to be cancelled immediately by https://github.com/Kong/swrv/blob/415f8eb0d6a4dd85cf34c76997308448669c9514/src/use-swrv.ts#L380

Investigate and write tests for refreshInterval working as expected.

Pull request:
fix(timers) should refreshInterval on dependent watchers
Fixes #101

Patch:
diff --git a/src/use-swrv.ts b/src/use-swrv.ts
index aa3531a..ee56cf0 100644
--- a/src/use-swrv.ts
+++ b/src/use-swrv.ts
@@ -381,9 +381,6 @@ function useSWRV<Data = any, Error = any> (...args): IResponse<Data, Error> {
         revalidate()
       }
       isHydrated = false
-      if (timer) {
-        clearTimeout(timer)
-      }
     }, {
       immediate: true
     } as Partial<WatcherOptionCompat>)


Test patch:
diff --git a/tests/use-swrv.spec.tsx b/tests/use-swrv.spec.tsx
index cdf8369..73f59fd 100644
--- a/tests/use-swrv.spec.tsx
+++ b/tests/use-swrv.spec.tsx
@@ -915,6 +915,48 @@ describe('useSWRV - refresh', () => {
     clear()
     done()
   })
+
+  it('should refresh on interval using dependent watchers', async done => {
+    type User = { id: string }
+    let count = -1
+    const vm = new Vue({
+      template: `<div v-if="user">User-{{user.id}} votes: {{ votes }}</div>`,
+      setup  () {
+        const { data: user } = useSWRV<User>('/users', () => {
+          return new Promise((res) => {
+            setTimeout(() => res({ id: '1' }), 200)
+          })
+        })
+        const { data: votes } = useSWRV(() => user.value && `/users/${user.value.id}/votes`, () => {
+          return ++count
+        }, {
+          refreshInterval: 200,
+          dedupingInterval: 0
+        })
+
+        return {
+          user,
+          votes
+        }
+      }
+    }).$mount()
+
+    await tick(2)
+    expect(vm.$el.textContent).toEqual('')
+    timeout(210)
+    await tick(2)
+    expect(vm.$el.textContent).toEqual('User-1 votes: 0')
+    timeout(50)
+    await tick(2)
+    expect(vm.$el.textContent).toEqual('User-1 votes: 0')
+    timeout(150)
+    await tick(2)
+    expect(vm.$el.textContent).toEqual('User-1 votes: 1')
+    timeout(200)
+    await tick(2)
+    expect(vm.$el.textContent).toEqual('User-1 votes: 2')
+    done()
+  })
 })
 
 describe('useSWRV - error', () => {