Comparing version
@@ -12,3 +12,3 @@ import { c } from "react-compiler-runtime"; | ||
function useObservable(observable, initialValue) { | ||
const $ = c(12); | ||
const $ = c(8); | ||
if (!cache.has(observable)) { | ||
@@ -34,23 +34,21 @@ const entry = { | ||
let t2; | ||
$[2] !== instance.observable ? (t2 = (onStoreChange) => { | ||
console.count("subscribe"); | ||
const subscription_0 = instance.observable.subscribe(onStoreChange); | ||
return () => { | ||
subscription_0.unsubscribe(); | ||
}; | ||
}, $[2] = instance.observable, $[3] = t2) : t2 = $[3]; | ||
$[2] !== instance.observable ? (t2 = { | ||
subscribe: (onStoreChange) => { | ||
console.count("subscribe"); | ||
const subscription_0 = instance.observable.subscribe(onStoreChange); | ||
return () => { | ||
subscription_0.unsubscribe(); | ||
}; | ||
} | ||
}, $[2] = instance.observable, $[3] = t2) : t2 = $[3], t0 = t2; | ||
const store = t0; | ||
let t3; | ||
$[4] !== instance.error || $[5] !== instance.snapshot ? (t3 = () => { | ||
if (console.count("getSnapshot"), instance.error) | ||
throw instance.error; | ||
return instance.snapshot; | ||
}, $[4] = instance.error, $[5] = instance.snapshot, $[6] = t3) : t3 = $[6]; | ||
$[4] !== observable ? (t3 = () => { | ||
const instance_0 = cache.get(observable); | ||
if (console.count("getSnapshot"), instance_0.error) | ||
throw instance_0.error; | ||
return instance_0.snapshot; | ||
}, $[4] = observable, $[5] = t3) : t3 = $[5]; | ||
let t4; | ||
$[7] !== t2 || $[8] !== t3 ? (t4 = { | ||
subscribe: t2, | ||
getSnapshot: t3 | ||
}, $[7] = t2, $[8] = t3, $[9] = t4) : t4 = $[9], t0 = t4; | ||
const store = t0; | ||
let t5; | ||
return $[10] !== initialValue ? (t5 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[10] = initialValue, $[11] = t5) : t5 = $[11], useSyncExternalStore(store.subscribe, store.getSnapshot, t5); | ||
return $[6] !== initialValue ? (t4 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[6] = initialValue, $[7] = t4) : t4 = $[7], useSyncExternalStore(store.subscribe, t3, t4); | ||
} | ||
@@ -57,0 +55,0 @@ function _temp4() { |
{ | ||
"name": "react-rx", | ||
"version": "4.1.0-canary.1", | ||
"version": "4.1.0-canary.2", | ||
"description": "React + RxJS = <3", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -83,9 +83,2 @@ import {useMemo, useSyncExternalStore} from 'react' | ||
}, | ||
getSnapshot: () => { | ||
console.count('getSnapshot') | ||
if (instance.error) { | ||
throw instance.error | ||
} | ||
return instance.snapshot | ||
}, | ||
} | ||
@@ -96,3 +89,11 @@ }, [observable]) | ||
store.subscribe, | ||
store.getSnapshot, | ||
() => { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const instance = cache.get(observable)! | ||
console.count('getSnapshot') | ||
if (instance.error) { | ||
throw instance.error | ||
} | ||
return instance.snapshot | ||
}, | ||
typeof initialValue === 'undefined' | ||
@@ -99,0 +100,0 @@ ? undefined |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
46571
-1.07%623
-0.48%