Comparing version 4.1.0-canary.4 to 4.1.0-canary.5
@@ -12,3 +12,3 @@ import { c } from "react-compiler-runtime"; | ||
function useObservable(observable, initialValue) { | ||
const $ = c(6); | ||
const $ = c(9); | ||
if (!cache.has(observable)) { | ||
@@ -29,18 +29,20 @@ const entry = { | ||
let t0; | ||
$[0] !== observable ? (t0 = (onStoreChange) => { | ||
const subscription_0 = cache.get(observable).observable.subscribe(onStoreChange); | ||
$[0] !== observable ? (t0 = cache.get(observable), $[0] = observable, $[1] = t0) : t0 = $[1]; | ||
const instance = t0; | ||
let t1; | ||
$[2] !== instance.observable ? (t1 = (onStoreChange) => { | ||
const subscription_0 = instance.observable.subscribe(onStoreChange); | ||
return () => { | ||
subscription_0.unsubscribe(); | ||
}; | ||
}, $[0] = observable, $[1] = t0) : t0 = $[1]; | ||
const subscribe = t0; | ||
let t1; | ||
$[2] !== observable ? (t1 = () => { | ||
const instance_0 = cache.get(observable); | ||
if (instance_0.error) | ||
throw instance_0.error; | ||
return instance_0.snapshot; | ||
}, $[2] = observable, $[3] = t1) : t1 = $[3]; | ||
}, $[2] = instance.observable, $[3] = t1) : t1 = $[3]; | ||
const subscribe = t1; | ||
let t2; | ||
return $[4] !== initialValue ? (t2 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[4] = initialValue, $[5] = t2) : t2 = $[5], useSyncExternalStore(subscribe, t1, t2); | ||
$[4] !== instance.error || $[5] !== instance.snapshot ? (t2 = () => { | ||
if (instance.error) | ||
throw instance.error; | ||
return instance.snapshot; | ||
}, $[4] = instance.error, $[5] = instance.snapshot, $[6] = t2) : t2 = $[6]; | ||
let t3; | ||
return $[7] !== initialValue ? (t3 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[7] = initialValue, $[8] = t3) : t3 = $[8], useSyncExternalStore(subscribe, t2, t3); | ||
} | ||
@@ -47,0 +49,0 @@ function _temp4() { |
{ | ||
"name": "react-rx", | ||
"version": "4.1.0-canary.4", | ||
"version": "4.1.0-canary.5", | ||
"description": "React + RxJS = <3", | ||
@@ -83,2 +83,3 @@ "keywords": [ | ||
"@typescript-eslint/parser": "^8.12.2", | ||
"@vitejs/plugin-react": "^4.3.3", | ||
"babel-plugin-react-compiler": "beta", | ||
@@ -85,0 +86,0 @@ "eslint": "^8.57.1", |
@@ -70,6 +70,6 @@ import {useCallback, useSyncExternalStore} from 'react' | ||
} | ||
const instance = cache.get(observable)! | ||
const subscribe = useCallback( | ||
(onStoreChange: () => void) => { | ||
const instance = cache.get(observable)! | ||
const subscription = instance.observable.subscribe(onStoreChange) | ||
@@ -80,3 +80,3 @@ return () => { | ||
}, | ||
[observable], | ||
[instance.observable], | ||
) | ||
@@ -87,3 +87,2 @@ | ||
() => { | ||
const instance = cache.get(observable)! | ||
if (instance.error) { | ||
@@ -90,0 +89,0 @@ throw instance.error |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45113
604
28