Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

QueryResource.md

77 lines2.4 KB

Defined in: packages/angular-query/src/query-resource.ts:6

Extends

  • Resource<TValue>

Type Parameters

TValue

TValue

Properties

PropertyModifierTypeDescriptionOverrides
errorreadonlySignal<Error | undefined>When in the error state, this returns the last known error from the Resource.-
isLoadingreadonlySignal<boolean>Whether this resource is loading a new value (or reloading the existing one).-
reloadpublic() => booleanRequests a new query fetch only when the current query data is stale. Used for compatibility with Angular APIs that might want to reload a resource, like Signal Forms' validateAsync resource interface.-
snapshotreadonlySignal<ResourceSnapshot<TValue>>The current query state as a single snapshot.Resource.snapshot
statusreadonlySignal<ResourceStatus>The current status of the Resource, which describes what the resource is currently doing and what can be expected of its value.-
valuereadonlySignal<TValue>The current value of the Resource, or throws an error if the resource is in an error state.-

Methods

hasValue()

Call Signature

hasValue(this: TValue extends undefined ? QueryResource<TValue> : never): this is Resource<Exclude<TValue, undefined>>;

Defined in: node_modules/.pnpm/@angular+core@22.1.6_@angular+compiler@22.1.6_rxjs@7.8.2_zone.js@0.16.1/node_modules/@angular/core/types/_api-chunk.d.ts:186

Whether this resource has a valid current value.

This function is reactive.

Parameters
this

TValue extends undefined ? QueryResource<TValue> : never

Returns

this is Resource<Exclude<TValue, undefined>>

Inherited from
Resource.hasValue

Call Signature

hasValue(): boolean;

Defined in: node_modules/.pnpm/@angular+core@22.1.6_@angular+compiler@22.1.6_rxjs@7.8.2_zone.js@0.16.1/node_modules/@angular/core/types/_api-chunk.d.ts:187

Returns

boolean

Inherited from
Resource.hasValue