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

@equinor/fusion-observable

Package Overview
Dependencies
Maintainers
3
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion-observable - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

12

dist/esm/react/useQueryClient.js
import { useEffect, useMemo, useState } from 'react';
import { share, Subject } from 'rxjs';
import { QueryClient } from '../query';
import { QueryClient, QueryStatus } from '../query';
import { useObservableSelector } from './useObservableSelector';

@@ -14,9 +14,11 @@ import { useObservableState } from './useObservableState';

};
export const useQueryClient = (queryFn, options) => {
const { data$, status$, ...obj } = useQueryClient$(queryFn, options);
export const useQueryClientStreamResult = (result) => {
const { data$, status$, ...obj } = result;
const data = useObservableState(data$);
const status = useObservableState(status$);
return { ...obj, data, status };
const status = useObservableState(status$) ?? QueryStatus.IDLE;
const isLoading = useMemo(() => status === QueryStatus.ACTIVE, [status]);
return Object.assign(obj, { data, status, isLoading });
};
export const useQueryClient = (queryFn, options) => useQueryClientStreamResult(useQueryClient$(queryFn, options));
export default useQueryClient;
//# sourceMappingURL=useQueryClient.js.map

@@ -1,14 +0,24 @@

import { QueryClient, QueryFn, QueryOptions } from '../query';
export declare const useQueryClient$: <TType, TArgs>(queryFn: QueryFn<TType, TArgs>, options?: QueryOptions<TType, TArgs> | undefined) => {
import { Observable } from 'rxjs';
import { QueryClient, QueryFn, QueryOptions, QueryStatus } from '../query';
export declare type UseQueryClientStreamResult<TType, TArgs> = {
client: QueryClient<TType, TArgs>;
data$: import("rxjs").Observable<TType>;
status$: import("rxjs").Observable<import("../query").QueryStatus>;
query: (q: TArgs) => void;
data$: Observable<TType>;
status$: Observable<QueryStatus>;
query: (args: TArgs) => void;
};
export declare const useQueryClient: <TType, TArgs>(queryFn: QueryFn<TType, TArgs>, options?: QueryOptions<TType, TArgs> | undefined) => {
export declare type UseQueryClientResult<TType, TArgs> = Omit<UseQueryClientStreamResult<TType, TArgs>, 'data$' | 'status$'> & {
data: TType | undefined;
status: import("../query").QueryStatus | undefined;
client: QueryClient<TType, TArgs>;
query: (q: TArgs) => void;
status: QueryStatus;
isLoading: boolean;
};
export declare const useQueryClient$: <TType, TArgs>(queryFn: QueryFn<TType, TArgs>, options?: QueryOptions<TType, TArgs> | undefined) => UseQueryClientStreamResult<TType, TArgs>;
export declare const useQueryClientStreamResult: <TType, TArgs extends {
data$: Observable<TType>;
status$: Observable<QueryStatus>;
}>(result: TArgs) => {
data: TType | undefined;
status: QueryStatus;
isLoading: boolean;
} & Omit<TArgs, "data$" | "$status">;
export declare const useQueryClient: <TType, TArgs>(queryFn: QueryFn<TType, TArgs>, options?: QueryOptions<TType, TArgs> | undefined) => UseQueryClientResult<TType, TArgs>;
export default useQueryClient;
{
"name": "@equinor/fusion-observable",
"version": "0.2.0",
"version": "0.3.0",
"description": "WIP",

@@ -84,3 +84,3 @@ "private": false,

},
"gitHead": "5f5ceed6b3f4f6ab12036f1f2953d293dff86cae"
"gitHead": "472e06a77cfccc723b0fb88e628d10df18eab5e1"
}

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