Socket
Socket
Sign inDemoInstall

@tanstack/vue-query

Package Overview
Dependencies
Maintainers
2
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/vue-query - npm Package Compare versions

Comparing version 5.54.1 to 5.54.2

build/legacy/queryClient-Bq4NnYa7.d.ts

2

build/legacy/devtools/devtools.d.ts

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

import { Q as QueryClient } from '../queryClient-hn1RYJHC.js';
import { Q as QueryClient } from '../queryClient-Bq4NnYa7.js';
import '@tanstack/query-core';

@@ -3,0 +3,0 @@ import 'vue-demi';

export * from '@tanstack/query-core';
export { useQueryClient } from './useQueryClient.js';
export { VueQueryPlugin, VueQueryPluginOptions } from './vueQueryPlugin.js';
export { D as DefinedInitialQueryOptions, Q as QueryClient, d as UndefinedInitialQueryOptions, e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './queryClient-hn1RYJHC.js';
export { D as DefinedInitialQueryOptions, Q as QueryClient, d as UndefinedInitialQueryOptions, e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './queryClient-Bq4NnYa7.js';
export { QueryCache } from './queryCache.js';

@@ -6,0 +6,0 @@ export { queryOptions } from './queryOptions.js';

import { DefaultError, InfiniteData, QueryKey, DataTag } from '@tanstack/query-core';
import { e as UseInfiniteQueryOptions } from './queryClient-hn1RYJHC.js';
import { e as UseInfiniteQueryOptions } from './queryClient-Bq4NnYa7.js';
import 'vue-demi';

@@ -4,0 +4,0 @@ import './types.js';

import '@tanstack/query-core';
export { Q as QueryClient } from './queryClient-hn1RYJHC.js';
export { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import 'vue-demi';
import './types.js';
import { DefaultError, QueryKey, DataTag } from '@tanstack/query-core';
import { d as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './queryClient-hn1RYJHC.js';
import { d as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './queryClient-Bq4NnYa7.js';
import 'vue-demi';

@@ -4,0 +4,0 @@ import './types.js';

import 'vue-demi';
import '@tanstack/query-core';
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './queryClient-hn1RYJHC.js';
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './queryClient-Bq4NnYa7.js';
import './types.js';

@@ -6,4 +6,5 @@ // src/useBaseQuery.ts

onScopeDispose,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRefs,

@@ -33,3 +34,3 @@ watch

const observer = new Observer(client, defaultedOptions.value);
const state = reactive(observer.getCurrentResult());
const state = shallowReactive(observer.getCurrentResult());
let unsubscribe = () => {

@@ -106,3 +107,7 @@ };

);
const object = toRefs(readonly(state));
const readonlyState = process.env.NODE_ENV === "production" ? state : (
// @ts-expect-error
defaultedOptions.value.shallow ? shallowReadonly(state) : readonly(state)
);
const object = toRefs(readonlyState);
for (const key in state) {

@@ -109,0 +114,0 @@ if (typeof state[key] === "function") {

import '@tanstack/query-core';
export { e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './queryClient-hn1RYJHC.js';
export { e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './queryClient-Bq4NnYa7.js';
import './types.js';
import 'vue-demi';
import { Ref } from 'vue-demi';
import { QueryFilters as QueryFilters$1 } from '@tanstack/query-core';
import { MaybeRefDeep } from './types.js';
import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';

@@ -6,0 +6,0 @@ type QueryFilters = MaybeRefDeep<QueryFilters$1>;

import { ToRefs } from 'vue-demi';
import { DefaultError, MutationObserverOptions, MutateFunction, MutationObserverResult } from '@tanstack/query-core';
import { DefaultError, MutateFunction, MutationObserverResult, MutationObserverOptions } from '@tanstack/query-core';
import { MaybeRefDeep, DistributiveOmit } from './types.js';
import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
type MutationResult<TData, TError, TVariables, TContext> = DistributiveOmit<MutationObserverResult<TData, TError, TVariables, TContext>, 'mutate' | 'reset'>;
type UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MaybeRefDeep<MutationObserverOptions<TData, TError, TVariables, TContext>>;
type UseMutationOptionsBase<TData, TError, TVariables, TContext> = MutationObserverOptions<TData, TError, TVariables, TContext> & {
shallow?: boolean;
};
type UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MaybeRefDeep<UseMutationOptionsBase<TData, TError, TVariables, TContext>>;
type MutateSyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...options: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void;

@@ -14,4 +17,4 @@ type UseMutationReturnType<TData, TError, TVariables, TContext, TResult = MutationResult<TData, TError, TVariables, TContext>> = ToRefs<Readonly<TResult>> & {

};
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(mutationOptions: MaybeRefDeep<MutationObserverOptions<TData, TError, TVariables, TContext>>, queryClient?: QueryClient): UseMutationReturnType<TData, TError, TVariables, TContext>;
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(mutationOptions: MaybeRefDeep<UseMutationOptionsBase<TData, TError, TVariables, TContext>>, queryClient?: QueryClient): UseMutationReturnType<TData, TError, TVariables, TContext>;
export { type UseMutationOptions, type UseMutationReturnType, useMutation };

@@ -6,4 +6,5 @@ // src/useMutation.ts

onScopeDispose,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRefs,

@@ -28,3 +29,3 @@ watch

const observer = new MutationObserver(client, options.value);
const state = reactive(observer.getCurrentResult());
const state = shallowReactive(observer.getCurrentResult());
const unsubscribe = observer.subscribe((result) => {

@@ -43,3 +44,4 @@ updateState(state, result);

});
const resultRefs = toRefs(readonly(state));
const readonlyState = process.env.NODE_ENV === "production" ? state : options.value.shallow ? shallowReadonly(state) : readonly(state);
const resultRefs = toRefs(readonlyState);
watch(

@@ -46,0 +48,0 @@ () => state.error,

@@ -1,4 +0,4 @@

import { Ref, DeepReadonly } from 'vue-demi';
import { Ref } from 'vue-demi';
import { MutationFilters as MutationFilters$1, MutationState, Mutation } from '@tanstack/query-core';
import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import { MaybeRefDeep } from './types.js';

@@ -12,4 +12,4 @@

};
declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): DeepReadonly<Ref<Array<TResult>>>;
declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): Readonly<Ref<Array<TResult>>>;
export { type MutationFilters, type MutationStateOptions, useIsMutating, useMutationState };

@@ -6,4 +6,4 @@ // src/useMutationState.ts

onScopeDispose,
readonly,
ref,
shallowReadonly,
shallowRef,
watch

@@ -42,3 +42,3 @@ } from "vue-demi";

const mutationCache = (queryClient || useQueryClient()).getMutationCache();
const state = ref(getResult(mutationCache, options));
const state = shallowRef(getResult(mutationCache, options));
const unsubscribe = mutationCache.subscribe(() => {

@@ -54,3 +54,3 @@ const result = getResult(mutationCache, options);

});
return readonly(state);
return shallowReadonly(state);
}

@@ -57,0 +57,0 @@ export {

import { Ref } from 'vue-demi';
import { QueryObserverResult, DefaultError, QueryKey, QueryFunction, ThrowOnError, DefinedQueryObserverResult } from '@tanstack/query-core';
import { Q as QueryClient, U as UseQueryOptions } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient, U as UseQueryOptions } from './queryClient-Bq4NnYa7.js';
import { MaybeRefDeep, DeepUnwrapRef } from './types.js';

@@ -78,4 +78,5 @@

combine?: (result: UseQueriesResults<T>) => TCombinedResult;
shallow?: boolean;
}, queryClient?: QueryClient): Readonly<Ref<TCombinedResult>>;
export { type UseQueriesOptions, type UseQueriesResults, useQueries };

@@ -8,2 +8,3 @@ // src/useQueries.ts

readonly,
shallowReadonly,
shallowRef,

@@ -90,3 +91,3 @@ unref,

});
return readonly(state);
return process.env.NODE_ENV === "production" ? state : options.shallow ? shallowReadonly(state) : readonly(state);
}

@@ -93,0 +94,0 @@ export {

import '@tanstack/query-core';
export { D as DefinedInitialQueryOptions, d as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './queryClient-hn1RYJHC.js';
export { D as DefinedInitialQueryOptions, d as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './queryClient-Bq4NnYa7.js';
import './types.js';
import 'vue-demi';

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

import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import '@tanstack/query-core';

@@ -3,0 +3,0 @@ import 'vue-demi';

@@ -6,3 +6,3 @@ import { MaybeRefDeep } from './types.js';

declare function getClientKey(key?: string): string;
declare function updateState(state: Record<string, unknown>, update: Record<string, any>): void;
declare function updateState(state: Record<string, any>, update: Record<string, any>): void;
declare function cloneDeep<T>(value: MaybeRefDeep<T>, customize?: (val: MaybeRefDeep<T>, key: string, level: number) => T | undefined): T;

@@ -9,0 +9,0 @@ declare function cloneDeepUnref<T>(obj: MaybeRefDeep<T>, unrefGetters?: boolean): T;

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

import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import { QueryClientConfig } from '@tanstack/query-core';

@@ -3,0 +3,0 @@ import 'vue-demi';

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

import { Q as QueryClient } from '../queryClient-hn1RYJHC.js';
import { Q as QueryClient } from '../queryClient-Bq4NnYa7.js';
import '@tanstack/query-core';

@@ -3,0 +3,0 @@ import 'vue-demi';

export * from '@tanstack/query-core';
export { useQueryClient } from './useQueryClient.js';
export { VueQueryPlugin, VueQueryPluginOptions } from './vueQueryPlugin.js';
export { D as DefinedInitialQueryOptions, Q as QueryClient, d as UndefinedInitialQueryOptions, e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './queryClient-hn1RYJHC.js';
export { D as DefinedInitialQueryOptions, Q as QueryClient, d as UndefinedInitialQueryOptions, e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, a as useInfiniteQuery, u as useQuery } from './queryClient-Bq4NnYa7.js';
export { QueryCache } from './queryCache.js';

@@ -6,0 +6,0 @@ export { queryOptions } from './queryOptions.js';

import { DefaultError, InfiniteData, QueryKey, DataTag } from '@tanstack/query-core';
import { e as UseInfiniteQueryOptions } from './queryClient-hn1RYJHC.js';
import { e as UseInfiniteQueryOptions } from './queryClient-Bq4NnYa7.js';
import 'vue-demi';

@@ -4,0 +4,0 @@ import './types.js';

import '@tanstack/query-core';
export { Q as QueryClient } from './queryClient-hn1RYJHC.js';
export { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import 'vue-demi';
import './types.js';
import { DefaultError, QueryKey, DataTag } from '@tanstack/query-core';
import { d as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './queryClient-hn1RYJHC.js';
import { d as UndefinedInitialQueryOptions, D as DefinedInitialQueryOptions } from './queryClient-Bq4NnYa7.js';
import 'vue-demi';

@@ -4,0 +4,0 @@ import './types.js';

import 'vue-demi';
import '@tanstack/query-core';
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './queryClient-hn1RYJHC.js';
export { g as UseBaseQueryReturnType, h as useBaseQuery } from './queryClient-Bq4NnYa7.js';
import './types.js';

@@ -6,4 +6,5 @@ // src/useBaseQuery.ts

onScopeDispose,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRefs,

@@ -33,3 +34,3 @@ watch

const observer = new Observer(client, defaultedOptions.value);
const state = reactive(observer.getCurrentResult());
const state = shallowReactive(observer.getCurrentResult());
let unsubscribe = () => {

@@ -106,3 +107,7 @@ };

);
const object = toRefs(readonly(state));
const readonlyState = process.env.NODE_ENV === "production" ? state : (
// @ts-expect-error
defaultedOptions.value.shallow ? shallowReadonly(state) : readonly(state)
);
const object = toRefs(readonlyState);
for (const key in state) {

@@ -109,0 +114,0 @@ if (typeof state[key] === "function") {

import '@tanstack/query-core';
export { e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './queryClient-hn1RYJHC.js';
export { e as UseInfiniteQueryOptions, f as UseInfiniteQueryReturnType, a as useInfiniteQuery } from './queryClient-Bq4NnYa7.js';
import './types.js';
import 'vue-demi';
import { Ref } from 'vue-demi';
import { QueryFilters as QueryFilters$1 } from '@tanstack/query-core';
import { MaybeRefDeep } from './types.js';
import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';

@@ -6,0 +6,0 @@ type QueryFilters = MaybeRefDeep<QueryFilters$1>;

import { ToRefs } from 'vue-demi';
import { DefaultError, MutationObserverOptions, MutateFunction, MutationObserverResult } from '@tanstack/query-core';
import { DefaultError, MutateFunction, MutationObserverResult, MutationObserverOptions } from '@tanstack/query-core';
import { MaybeRefDeep, DistributiveOmit } from './types.js';
import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
type MutationResult<TData, TError, TVariables, TContext> = DistributiveOmit<MutationObserverResult<TData, TError, TVariables, TContext>, 'mutate' | 'reset'>;
type UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MaybeRefDeep<MutationObserverOptions<TData, TError, TVariables, TContext>>;
type UseMutationOptionsBase<TData, TError, TVariables, TContext> = MutationObserverOptions<TData, TError, TVariables, TContext> & {
shallow?: boolean;
};
type UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MaybeRefDeep<UseMutationOptionsBase<TData, TError, TVariables, TContext>>;
type MutateSyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...options: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void;

@@ -14,4 +17,4 @@ type UseMutationReturnType<TData, TError, TVariables, TContext, TResult = MutationResult<TData, TError, TVariables, TContext>> = ToRefs<Readonly<TResult>> & {

};
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(mutationOptions: MaybeRefDeep<MutationObserverOptions<TData, TError, TVariables, TContext>>, queryClient?: QueryClient): UseMutationReturnType<TData, TError, TVariables, TContext>;
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(mutationOptions: MaybeRefDeep<UseMutationOptionsBase<TData, TError, TVariables, TContext>>, queryClient?: QueryClient): UseMutationReturnType<TData, TError, TVariables, TContext>;
export { type UseMutationOptions, type UseMutationReturnType, useMutation };

@@ -6,4 +6,5 @@ // src/useMutation.ts

onScopeDispose,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRefs,

@@ -28,3 +29,3 @@ watch

const observer = new MutationObserver(client, options.value);
const state = reactive(observer.getCurrentResult());
const state = shallowReactive(observer.getCurrentResult());
const unsubscribe = observer.subscribe((result) => {

@@ -43,3 +44,4 @@ updateState(state, result);

});
const resultRefs = toRefs(readonly(state));
const readonlyState = process.env.NODE_ENV === "production" ? state : options.value.shallow ? shallowReadonly(state) : readonly(state);
const resultRefs = toRefs(readonlyState);
watch(

@@ -46,0 +48,0 @@ () => state.error,

@@ -1,4 +0,4 @@

import { Ref, DeepReadonly } from 'vue-demi';
import { Ref } from 'vue-demi';
import { MutationFilters as MutationFilters$1, MutationState, Mutation } from '@tanstack/query-core';
import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import { MaybeRefDeep } from './types.js';

@@ -12,4 +12,4 @@

};
declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): DeepReadonly<Ref<Array<TResult>>>;
declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): Readonly<Ref<Array<TResult>>>;
export { type MutationFilters, type MutationStateOptions, useIsMutating, useMutationState };

@@ -6,4 +6,4 @@ // src/useMutationState.ts

onScopeDispose,
readonly,
ref,
shallowReadonly,
shallowRef,
watch

@@ -42,3 +42,3 @@ } from "vue-demi";

const mutationCache = (queryClient || useQueryClient()).getMutationCache();
const state = ref(getResult(mutationCache, options));
const state = shallowRef(getResult(mutationCache, options));
const unsubscribe = mutationCache.subscribe(() => {

@@ -54,3 +54,3 @@ const result = getResult(mutationCache, options);

});
return readonly(state);
return shallowReadonly(state);
}

@@ -57,0 +57,0 @@ export {

import { Ref } from 'vue-demi';
import { QueryObserverResult, DefaultError, QueryKey, QueryFunction, ThrowOnError, DefinedQueryObserverResult } from '@tanstack/query-core';
import { Q as QueryClient, U as UseQueryOptions } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient, U as UseQueryOptions } from './queryClient-Bq4NnYa7.js';
import { MaybeRefDeep, DeepUnwrapRef } from './types.js';

@@ -78,4 +78,5 @@

combine?: (result: UseQueriesResults<T>) => TCombinedResult;
shallow?: boolean;
}, queryClient?: QueryClient): Readonly<Ref<TCombinedResult>>;
export { type UseQueriesOptions, type UseQueriesResults, useQueries };

@@ -8,2 +8,3 @@ // src/useQueries.ts

readonly,
shallowReadonly,
shallowRef,

@@ -90,3 +91,3 @@ unref,

});
return readonly(state);
return process.env.NODE_ENV === "production" ? state : options.shallow ? shallowReadonly(state) : readonly(state);
}

@@ -93,0 +94,0 @@ export {

import '@tanstack/query-core';
export { D as DefinedInitialQueryOptions, d as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './queryClient-hn1RYJHC.js';
export { D as DefinedInitialQueryOptions, d as UndefinedInitialQueryOptions, c as UseQueryDefinedReturnType, U as UseQueryOptions, b as UseQueryReturnType, u as useQuery } from './queryClient-Bq4NnYa7.js';
import './types.js';
import 'vue-demi';

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

import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import '@tanstack/query-core';

@@ -3,0 +3,0 @@ import 'vue-demi';

@@ -6,3 +6,3 @@ import { MaybeRefDeep } from './types.js';

declare function getClientKey(key?: string): string;
declare function updateState(state: Record<string, unknown>, update: Record<string, any>): void;
declare function updateState(state: Record<string, any>, update: Record<string, any>): void;
declare function cloneDeep<T>(value: MaybeRefDeep<T>, customize?: (val: MaybeRefDeep<T>, key: string, level: number) => T | undefined): T;

@@ -9,0 +9,0 @@ declare function cloneDeepUnref<T>(obj: MaybeRefDeep<T>, unrefGetters?: boolean): T;

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

import { Q as QueryClient } from './queryClient-hn1RYJHC.js';
import { Q as QueryClient } from './queryClient-Bq4NnYa7.js';
import { QueryClientConfig } from '@tanstack/query-core';

@@ -3,0 +3,0 @@ import 'vue-demi';

{
"name": "@tanstack/vue-query",
"version": "5.54.1",
"version": "5.54.2",
"description": "Hooks for managing, caching and syncing asynchronous and remote data in Vue",

@@ -5,0 +5,0 @@ "author": "Damian Osipiuk",

@@ -5,4 +5,5 @@ import {

onScopeDispose,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRefs,

@@ -109,3 +110,3 @@ watch,

const observer = new Observer(client, defaultedOptions.value)
const state = reactive(observer.getCurrentResult())
const state = shallowReactive(observer.getCurrentResult())

@@ -206,3 +207,11 @@ let unsubscribe = () => {

const object: any = toRefs(readonly(state))
const readonlyState =
process.env.NODE_ENV === 'production'
? state
: // @ts-expect-error
defaultedOptions.value.shallow
? shallowReadonly(state)
: readonly(state)
const object: any = toRefs(readonlyState)
for (const key in state) {

@@ -209,0 +218,0 @@ if (typeof state[key as keyof typeof state] === 'function') {

@@ -52,2 +52,4 @@ import { InfiniteQueryObserver } from '@tanstack/query-core'

>
} & {
shallow?: boolean
}

@@ -54,0 +56,0 @@

@@ -5,4 +5,5 @@ import {

onScopeDispose,
reactive,
readonly,
shallowReactive,
shallowReadonly,
toRefs,

@@ -30,2 +31,7 @@ watch,

type UseMutationOptionsBase<TData, TError, TVariables, TContext> =
MutationObserverOptions<TData, TError, TVariables, TContext> & {
shallow?: boolean
}
export type UseMutationOptions<

@@ -36,3 +42,3 @@ TData = unknown,

TContext = unknown,
> = MaybeRefDeep<MutationObserverOptions<TData, TError, TVariables, TContext>>
> = MaybeRefDeep<UseMutationOptionsBase<TData, TError, TVariables, TContext>>

@@ -67,3 +73,3 @@ type MutateSyncFunction<

mutationOptions: MaybeRefDeep<
MutationObserverOptions<TData, TError, TVariables, TContext>
UseMutationOptionsBase<TData, TError, TVariables, TContext>
>,

@@ -85,3 +91,3 @@ queryClient?: QueryClient,

const observer = new MutationObserver(client, options.value)
const state = reactive(observer.getCurrentResult())
const state = shallowReactive(observer.getCurrentResult())

@@ -109,3 +115,10 @@ const unsubscribe = observer.subscribe((result) => {

const resultRefs = toRefs(readonly(state)) as unknown as ToRefs<
const readonlyState =
process.env.NODE_ENV === 'production'
? state
: options.value.shallow
? shallowReadonly(state)
: readonly(state)
const resultRefs = toRefs(readonlyState) as ToRefs<
Readonly<MutationResult<TData, TError, TVariables, TContext>>

@@ -112,0 +125,0 @@ >

@@ -5,4 +5,4 @@ import {

onScopeDispose,
readonly,
ref,
shallowReadonly,
shallowRef,
watch,

@@ -12,3 +12,3 @@ } from 'vue-demi'

import { cloneDeepUnref } from './utils'
import type { DeepReadonly, Ref } from 'vue-demi'
import type { Ref } from 'vue-demi'
import type {

@@ -73,6 +73,8 @@ MutationFilters as MF,

queryClient?: QueryClient,
): DeepReadonly<Ref<Array<TResult>>> {
): Readonly<Ref<Array<TResult>>> {
const filters = computed(() => cloneDeepUnref(options.filters))
const mutationCache = (queryClient || useQueryClient()).getMutationCache()
const state = ref(getResult(mutationCache, options)) as Ref<Array<TResult>>
const state = shallowRef(getResult(mutationCache, options)) as Ref<
Array<TResult>
>
const unsubscribe = mutationCache.subscribe(() => {

@@ -91,3 +93,3 @@ const result = getResult(mutationCache, options)

return readonly(state)
return shallowReadonly(state)
}

@@ -7,2 +7,3 @@ import { QueriesObserver } from '@tanstack/query-core'

readonly,
shallowReadonly,
shallowRef,

@@ -260,2 +261,3 @@ unref,

combine?: (result: UseQueriesResults<T>) => TCombinedResult
shallow?: boolean
},

@@ -353,3 +355,7 @@ queryClient?: QueryClient,

return readonly(state) as Readonly<Ref<TCombinedResult>>
return process.env.NODE_ENV === 'production'
? state
: options.shallow
? shallowReadonly(state)
: (readonly(state) as Readonly<Ref<TCombinedResult>>)
}

@@ -26,29 +26,33 @@ import { QueryObserver } from '@tanstack/query-core'

TQueryKey extends QueryKey = QueryKey,
> = MaybeRef<{
[Property in keyof QueryObserverOptions<
TQueryFnData,
TError,
TData,
TQueryData,
TQueryKey
>]: Property extends 'enabled'
? MaybeRefOrGetter<
QueryObserverOptions<
TQueryFnData,
TError,
TData,
TQueryData,
DeepUnwrapRef<TQueryKey>
>[Property]
>
: MaybeRefDeep<
QueryObserverOptions<
TQueryFnData,
TError,
TData,
TQueryData,
DeepUnwrapRef<TQueryKey>
>[Property]
>
}>
> = MaybeRef<
{
[Property in keyof QueryObserverOptions<
TQueryFnData,
TError,
TData,
TQueryData,
TQueryKey
>]: Property extends 'enabled'
? MaybeRefOrGetter<
QueryObserverOptions<
TQueryFnData,
TError,
TData,
TQueryData,
DeepUnwrapRef<TQueryKey>
>[Property]
>
: MaybeRefDeep<
QueryObserverOptions<
TQueryFnData,
TError,
TData,
TQueryData,
DeepUnwrapRef<TQueryKey>
>[Property]
>
} & {
shallow?: boolean
}
>

@@ -55,0 +59,0 @@ export type UndefinedInitialQueryOptions<

@@ -12,3 +12,3 @@ import { isRef, unref } from 'vue-demi'

export function updateState(
state: Record<string, unknown>,
state: Record<string, any>,
update: Record<string, any>,

@@ -15,0 +15,0 @@ ): void {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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