From 4b49d74e5f90896ddec1e311826f1646899609af Mon Sep 17 00:00:00 2001 From: Mike Hernas Date: Mon, 17 Jun 2024 13:31:41 +0200 Subject: [PATCH] Clear setImmediateId + add runtime types for setImmediate function --- packages/realm-react/src/cachedCollection.ts | 1 + packages/realm-react/src/runtime.d.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/realm-react/src/cachedCollection.ts b/packages/realm-react/src/cachedCollection.ts index 7027b8f5bb..806be0071e 100644 --- a/packages/realm-react/src/cachedCollection.ts +++ b/packages/realm-react/src/cachedCollection.ts @@ -199,6 +199,7 @@ export function createCachedCollection>({ if (!isDerived) { if (setImmediateId) { clearImmediate(setImmediateId); + setImmediateId = undefined; } collection.removeListener(listenerCallback); objectCache.clear(); diff --git a/packages/realm-react/src/runtime.d.ts b/packages/realm-react/src/runtime.d.ts index fe8d1c0211..d566d30825 100644 --- a/packages/realm-react/src/runtime.d.ts +++ b/packages/realm-react/src/runtime.d.ts @@ -25,3 +25,6 @@ declare type Console = { declare const console: Console; declare function setImmediate(cb: (...args: unknown[]) => void); + +declare type Timer = unknown; +declare function clearImmediate(timer: Timer): void;