diff --git a/docs/framework/react/react-native.md b/docs/framework/react/react-native.md index ad8d230c31..2c2d6fc0e2 100644 --- a/docs/framework/react/react-native.md +++ b/docs/framework/react/react-native.md @@ -165,7 +165,7 @@ export function useQueryFocusAware(notifyOnChangeProps?: NotifyOnChangeProps) { }, []), ) - return () => focusRef.current + return () => focusedRef.current useQuery({ queryKey: ['key'], diff --git a/examples/angular/basic/package.json b/examples/angular/basic/package.json index 881b1f0f79..57d6a8e3c3 100644 --- a/examples/angular/basic/package.json +++ b/examples/angular/basic/package.json @@ -14,7 +14,7 @@ "@angular/core": "^17.3.12", "@angular/platform-browser": "^17.3.12", "@angular/platform-browser-dynamic": "^17.3.12", - "@tanstack/angular-query-experimental": "^5.51.21", + "@tanstack/angular-query-experimental": "^5.51.22", "rxjs": "^7.8.1", "tslib": "^2.6.3", "zone.js": "^0.14.8" @@ -23,7 +23,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.12", - "@tanstack/angular-query-devtools-experimental": "^5.51.21", + "@tanstack/angular-query-devtools-experimental": "^5.51.22", "typescript": "5.3.3" } } diff --git a/examples/angular/infinite-query-with-max-pages/package.json b/examples/angular/infinite-query-with-max-pages/package.json index 7ac3348b21..309e338a7d 100644 --- a/examples/angular/infinite-query-with-max-pages/package.json +++ b/examples/angular/infinite-query-with-max-pages/package.json @@ -14,7 +14,7 @@ "@angular/core": "^17.3.12", "@angular/platform-browser": "^17.3.12", "@angular/platform-browser-dynamic": "^17.3.12", - "@tanstack/angular-query-experimental": "^5.51.21", + "@tanstack/angular-query-experimental": "^5.51.22", "rxjs": "^7.8.1", "tslib": "^2.6.3", "zone.js": "^0.14.8" @@ -23,7 +23,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.12", - "@tanstack/angular-query-devtools-experimental": "^5.51.21", + "@tanstack/angular-query-devtools-experimental": "^5.51.22", "typescript": "5.3.3" } } diff --git a/examples/angular/router/package.json b/examples/angular/router/package.json index 871e2209cd..fbb62e6987 100644 --- a/examples/angular/router/package.json +++ b/examples/angular/router/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "^17.3.12", "@angular/platform-browser-dynamic": "^17.3.12", "@angular/router": "^17.3.12", - "@tanstack/angular-query-experimental": "^5.51.21", + "@tanstack/angular-query-experimental": "^5.51.22", "rxjs": "^7.8.1", "tslib": "^2.6.3", "zone.js": "^0.14.8" @@ -24,7 +24,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.12", - "@tanstack/angular-query-devtools-experimental": "^5.51.21", + "@tanstack/angular-query-devtools-experimental": "^5.51.22", "typescript": "5.3.3" } } diff --git a/examples/angular/simple/package.json b/examples/angular/simple/package.json index 1ef421eb34..e1daa9345a 100644 --- a/examples/angular/simple/package.json +++ b/examples/angular/simple/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "^17.3.12", "@angular/platform-browser-dynamic": "^17.3.12", "@angular/router": "^17.3.12", - "@tanstack/angular-query-experimental": "^5.51.21", + "@tanstack/angular-query-experimental": "^5.51.22", "rxjs": "^7.8.1", "tslib": "^2.6.3", "zone.js": "^0.14.8" @@ -24,7 +24,7 @@ "@angular-devkit/build-angular": "^17.3.8", "@angular/cli": "^17.3.8", "@angular/compiler-cli": "^17.3.12", - "@tanstack/angular-query-devtools-experimental": "^5.51.21", + "@tanstack/angular-query-devtools-experimental": "^5.51.22", "typescript": "5.3.3" } } diff --git a/packages/angular-query-devtools-experimental/package.json b/packages/angular-query-devtools-experimental/package.json index 8f1a7c1d31..c74ce77897 100644 --- a/packages/angular-query-devtools-experimental/package.json +++ b/packages/angular-query-devtools-experimental/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/angular-query-devtools-experimental", - "version": "5.51.21", + "version": "5.51.22", "description": "Developer tools to interact with and visualize the TanStack/angular-query cache", "author": "Arnoud de Vries", "license": "MIT", diff --git a/packages/angular-query-experimental/etc/angular-query-experimental.api.md b/packages/angular-query-experimental/etc/angular-query-experimental.api.md index db449b52a5..aae6ed1093 100644 --- a/packages/angular-query-experimental/etc/angular-query-experimental.api.md +++ b/packages/angular-query-experimental/etc/angular-query-experimental.api.md @@ -12,6 +12,7 @@ import type { EnvironmentProviders } from '@angular/core'; import type { InfiniteData } from '@tanstack/query-core'; import type { InfiniteQueryObserverOptions } from '@tanstack/query-core'; import type { InfiniteQueryObserverResult } from '@tanstack/query-core'; +import type { InitialDataFunction } from '@tanstack/query-core'; import { InjectOptions } from '@angular/core'; import { Injector } from '@angular/core'; import type { MutateFunction } from '@tanstack/query-core'; @@ -120,20 +121,20 @@ export type DefinedInitialDataOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions): UndefinedInitialDataInfiniteOptions & { +export function infiniteQueryOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions): DefinedInitialDataInfiniteOptions & { queryKey: DataTag>; }; // @public -export function infiniteQueryOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions): DefinedInitialDataInfiniteOptions & { +export function infiniteQueryOptions, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions): UndefinedInitialDataInfiniteOptions & { queryKey: DataTag>; }; // @public -export function injectInfiniteQuery, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => UndefinedInitialDataInfiniteOptions, injector?: Injector): CreateInfiniteQueryResult; +export function injectInfiniteQuery, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => DefinedInitialDataInfiniteOptions, injector?: Injector): DefinedCreateInfiniteQueryResult; // @public -export function injectInfiniteQuery, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => DefinedInitialDataInfiniteOptions, injector?: Injector): DefinedCreateInfiniteQueryResult; +export function injectInfiniteQuery, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => UndefinedInitialDataInfiniteOptions, injector?: Injector): CreateInfiniteQueryResult; // @public export function injectInfiniteQuery, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(optionsFn: (client: QueryClient) => CreateInfiniteQueryOptions, injector?: Injector): CreateInfiniteQueryResult; @@ -224,12 +225,12 @@ GetResults ]> : T extends Array> ? Array> : Array; // @public -export function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & { +export function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & { queryKey: DataTag; }; // @public -export function queryOptions(options: DefinedInitialDataOptions): DefinedInitialDataOptions & { +export function queryOptions(options: UndefinedInitialDataOptions): UndefinedInitialDataOptions & { queryKey: DataTag; }; @@ -240,7 +241,7 @@ export type UndefinedInitialDataInfiniteOptions = CreateQueryOptions & { - initialData?: undefined; + initialData?: undefined | InitialDataFunction>; }; diff --git a/packages/angular-query-experimental/package.json b/packages/angular-query-experimental/package.json index 81c623233e..c66fc8710a 100644 --- a/packages/angular-query-experimental/package.json +++ b/packages/angular-query-experimental/package.json @@ -1,6 +1,6 @@ { "name": "@tanstack/angular-query-experimental", - "version": "5.51.21", + "version": "5.51.22", "description": "Signals for managing, caching and syncing asynchronous and remote data in Angular", "author": "Arnoud de Vries", "license": "MIT", diff --git a/packages/angular-query-experimental/src/infinite-query-options.ts b/packages/angular-query-experimental/src/infinite-query-options.ts index 3508951398..266df37910 100644 --- a/packages/angular-query-experimental/src/infinite-query-options.ts +++ b/packages/angular-query-experimental/src/infinite-query-options.ts @@ -63,14 +63,14 @@ export function infiniteQueryOptions< TQueryKey extends QueryKey = QueryKey, TPageParam = unknown, >( - options: UndefinedInitialDataInfiniteOptions< + options: DefinedInitialDataInfiniteOptions< TQueryFnData, TError, TData, TQueryKey, TPageParam >, -): UndefinedInitialDataInfiniteOptions< +): DefinedInitialDataInfiniteOptions< TQueryFnData, TError, TData, @@ -95,14 +95,14 @@ export function infiniteQueryOptions< TQueryKey extends QueryKey = QueryKey, TPageParam = unknown, >( - options: DefinedInitialDataInfiniteOptions< + options: UndefinedInitialDataInfiniteOptions< TQueryFnData, TError, TData, TQueryKey, TPageParam >, -): DefinedInitialDataInfiniteOptions< +): UndefinedInitialDataInfiniteOptions< TQueryFnData, TError, TData, diff --git a/packages/angular-query-experimental/src/inject-infinite-query.ts b/packages/angular-query-experimental/src/inject-infinite-query.ts index 85dd0c7b35..6f02f6588a 100644 --- a/packages/angular-query-experimental/src/inject-infinite-query.ts +++ b/packages/angular-query-experimental/src/inject-infinite-query.ts @@ -36,7 +36,7 @@ export function injectInfiniteQuery< >( optionsFn: ( client: QueryClient, - ) => UndefinedInitialDataInfiniteOptions< + ) => DefinedInitialDataInfiniteOptions< TQueryFnData, TError, TData, @@ -44,7 +44,7 @@ export function injectInfiniteQuery< TPageParam >, injector?: Injector, -): CreateInfiniteQueryResult +): DefinedCreateInfiniteQueryResult /** * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key. @@ -63,7 +63,7 @@ export function injectInfiniteQuery< >( optionsFn: ( client: QueryClient, - ) => DefinedInitialDataInfiniteOptions< + ) => UndefinedInitialDataInfiniteOptions< TQueryFnData, TError, TData, @@ -71,7 +71,7 @@ export function injectInfiniteQuery< TPageParam >, injector?: Injector, -): DefinedCreateInfiniteQueryResult +): CreateInfiniteQueryResult /** * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key. diff --git a/packages/angular-query-experimental/src/query-options.ts b/packages/angular-query-experimental/src/query-options.ts index 4bc4233ba2..3dc91a6d0a 100644 --- a/packages/angular-query-experimental/src/query-options.ts +++ b/packages/angular-query-experimental/src/query-options.ts @@ -60,8 +60,8 @@ export function queryOptions< TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, >( - options: UndefinedInitialDataOptions, -): UndefinedInitialDataOptions & { + options: DefinedInitialDataOptions, +): DefinedInitialDataOptions & { queryKey: DataTag } @@ -93,8 +93,8 @@ export function queryOptions< TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, >( - options: DefinedInitialDataOptions, -): DefinedInitialDataOptions & { + options: UndefinedInitialDataOptions, +): UndefinedInitialDataOptions & { queryKey: DataTag } diff --git a/packages/angular-query-experimental/tsconfig.json b/packages/angular-query-experimental/tsconfig.json index 04a006aad9..31e256a963 100644 --- a/packages/angular-query-experimental/tsconfig.json +++ b/packages/angular-query-experimental/tsconfig.json @@ -12,5 +12,11 @@ "target": "ES2022", "types": ["vitest/globals"] }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + }, "include": ["src", "eslint.config.js", "vite.config.ts"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0b1563b5ab..0e80c89f83 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -145,7 +145,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/compiler@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(@angular/platform-browser@17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))) '@tanstack/angular-query-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -167,7 +167,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/compiler@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -191,7 +191,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/compiler@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(@angular/platform-browser@17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))) '@tanstack/angular-query-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -213,7 +213,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/compiler@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -240,7 +240,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(@angular/platform-browser@17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(rxjs@7.8.1) '@tanstack/angular-query-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -262,7 +262,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/compiler@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3 @@ -289,7 +289,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(@angular/platform-browser@17.3.12(@angular/common@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8))(rxjs@7.8.1))(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(rxjs@7.8.1) '@tanstack/angular-query-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-experimental rxjs: specifier: ^7.8.1 @@ -311,7 +311,7 @@ importers: specifier: ^17.3.12 version: 17.3.12(@angular/compiler@17.3.12(@angular/core@17.3.12(rxjs@7.8.1)(zone.js@0.14.8)))(typescript@5.3.3) '@tanstack/angular-query-devtools-experimental': - specifier: ^5.51.21 + specifier: ^5.51.22 version: link:../../../packages/angular-query-devtools-experimental typescript: specifier: 5.3.3