Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-rx

Package Overview
Dependencies
Maintainers
62
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rx - npm Package Compare versions

Comparing version 4.1.2-canary.2 to 4.1.2-canary.3

45

dist/index.js
import { c } from "react-compiler-runtime";
import { useState, useSyncExternalStore, useEffect } from "react";
import { useSyncExternalStore, useState, useEffect } from "react";
import { catchError, of, finalize, share, timer, asapScheduler } from "rxjs";

@@ -12,11 +12,6 @@ import { map, tap } from "rxjs/operators";

function useObservable(observable, initialValue) {
const $ = c(14);
const $ = c(15);
let t0;
$[0] !== initialValue ? (t0 = () => () => getValue(initialValue), $[0] = initialValue, $[1] = t0) : t0 = $[1];
const [getInitialValue] = useState(t0);
let t1;
if (!cache.has(observable)) {
const entry = {
snapshot: getInitialValue()
};
const entry = {};
entry.observable = observable.pipe(map((value) => ({

@@ -28,7 +23,7 @@ snapshot: value,

error
})), tap((t22) => {
})), tap((t12) => {
const {
snapshot,
error: error_0
} = t22;
} = t12;
entry.snapshot = snapshot, entry.error = error_0;

@@ -40,7 +35,7 @@ }), map((value_0) => {

}
let t1;
$[0] !== observable ? (t1 = cache.get(observable), $[0] = observable, $[1] = t1) : t1 = $[1];
const instance = t1;
let t2;
$[2] !== observable ? (t2 = cache.get(observable), $[2] = observable, $[3] = t2) : t2 = $[3];
const instance = t2;
let t3;
$[4] !== instance.observable ? (t3 = (onStoreChange) => {
$[2] !== instance.observable ? (t2 = (onStoreChange) => {
const subscription_0 = instance.observable.subscribe(onStoreChange);

@@ -50,17 +45,19 @@ return () => {

};
}, $[4] = instance.observable, $[5] = t3) : t3 = $[5];
let t4;
$[6] !== instance.error || $[7] !== instance.snapshot ? (t4 = () => {
}, $[2] = instance.observable, $[3] = t2) : t2 = $[3];
let t3;
$[4] !== instance.error || $[5] !== instance.snapshot ? (t3 = () => {
if (instance.error)
throw instance.error;
return instance.snapshot;
}, $[6] = instance.error, $[7] = instance.snapshot, $[8] = t4) : t4 = $[8];
}, $[4] = instance.error, $[5] = instance.snapshot, $[6] = t3) : t3 = $[6];
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;
$[9] !== t3 || $[10] !== t4 ? (t5 = {
subscribe: t3,
getSnapshot: t4
}, $[9] = t3, $[10] = t4, $[11] = t5) : t5 = $[11], t1 = t5;
const store = t1;
$[10] !== store || $[11] !== initialValue ? (t5 = () => store.getSnapshot() ?? getValue(initialValue), $[10] = store, $[11] = initialValue, $[12] = t5) : t5 = $[12];
let t6;
return $[12] !== initialValue ? (t6 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[12] = initialValue, $[13] = t6) : t6 = $[13], useSyncExternalStore(store.subscribe, store.getSnapshot, t6);
return $[13] !== initialValue ? (t6 = typeof initialValue > "u" ? void 0 : () => getValue(initialValue), $[13] = initialValue, $[14] = t6) : t6 = $[14], useSyncExternalStore(store.subscribe, t5, t6);
}

@@ -67,0 +64,0 @@ function useObservableEvent(handleEvent) {

{
"name": "react-rx",
"version": "4.1.2-canary.2",
"version": "4.1.2-canary.3",
"description": "React + RxJS = <3",

@@ -5,0 +5,0 @@ "keywords": [

@@ -1,2 +0,2 @@

import {useMemo, useState, useSyncExternalStore} from 'react'
import {useMemo, useSyncExternalStore} from 'react'
import {

@@ -45,11 +45,5 @@ asapScheduler,

): InitialValue | ObservedValueOf<ObservableType> {
const [getInitialValue] = useState(
() => () => getValue(initialValue) as ObservedValueOf<ObservableType>,
)
const store = useMemo(() => {
if (!cache.has(observable)) {
const entry: Partial<CacheRecord<ObservedValueOf<ObservableType>>> = {
snapshot: getInitialValue(),
}
const entry: Partial<CacheRecord<ObservedValueOf<ObservableType>>> = {}
entry.observable = observable.pipe(

@@ -93,7 +87,7 @@ map((value) => ({snapshot: value, error: undefined})),

}
}, [observable, getInitialValue])
}, [observable])
return useSyncExternalStore<ObservedValueOf<ObservableType>>(
store.subscribe,
store.getSnapshot,
() => store.getSnapshot() ?? (getValue(initialValue) as ObservedValueOf<ObservableType>),
typeof initialValue === 'undefined'

@@ -100,0 +94,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc