From e6264c9bdc3f0b3f9aa70491089b0a79faff4de4 Mon Sep 17 00:00:00 2001 From: Jan Vincent Liwanag Date: Mon, 6 Jan 2025 17:45:04 +0800 Subject: [PATCH] Remove reassigmenment --- packages/rx/src/Rx.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/rx/src/Rx.ts b/packages/rx/src/Rx.ts index 8677db4..a45b0ab 100644 --- a/packages/rx/src/Rx.ts +++ b/packages/rx/src/Rx.ts @@ -1026,23 +1026,23 @@ export const family = typeof WeakRef === "undefined" || typeof FinalizationRegis ( f: (arg: Arg) => T ): (arg: Arg) => T => { - let atoms = MutableHashMap.empty() + const atoms = MutableHashMap.empty() return function(arg) { const atomEntry = MutableHashMap.get(atoms, arg) if (atomEntry._tag === "Some") { return atomEntry.value } const newAtom = f(arg) - atoms = MutableHashMap.set(atoms, arg, newAtom) + MutableHashMap.set(atoms, arg, newAtom) return newAtom } } : ( f: (arg: Arg) => T ): (arg: Arg) => T => { - let atoms = MutableHashMap.empty>() + const atoms = MutableHashMap.empty>() const registry = new FinalizationRegistry((arg) => { - atoms = MutableHashMap.remove(atoms, arg) + MutableHashMap.remove(atoms, arg) }) return function(arg) { const atomEntry = MutableHashMap.get(atoms, arg).pipe( @@ -1053,7 +1053,7 @@ export const family = typeof WeakRef === "undefined" || typeof FinalizationRegis return atomEntry.value } const newAtom = f(arg) - atoms = MutableHashMap.set(atoms, arg, new WeakRef(newAtom)) + MutableHashMap.set(atoms, arg, new WeakRef(newAtom)) registry.register(newAtom, arg) return newAtom }