* feat lit-query: add initial lit-query package * remove internal docs from initial PR * fix review issues * align scripts with monorepo Nx targets and use workspace:* for query-core * feat(lit-query): fix type inference and monorepo integration - Fix createQueriesController tuple type inference with recursive types - Add DataTag support to queryOptions - Fix build config and vitest custom-condition resolution - Fix example install scripts for standalone bootstrap * fix(lit-query): polish package validation and examples * ci: apply automated fixes * lit-query: preserve provider handshake ordering in BaseController * Update .changeset/lemon-memes-divide.md Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc> * removing prettier config from adapter, so that global config from the monorepo is used * removed the package local format scripts so formatting stays centralized at the monorepo root * removing like other adapters keep build and test:build as separate targets * Compared against the other adapters and removed the lit-query-only aliases/gates, keeping the standard Nx target names so root CI can pick them up consistently * package:check has been removed. The CJS smoke check is still needed because lit-query publishes custom CJS output/types * fix(lit-query): align lit examples and integration with monorepo conventions * chore(lit-query): clean up stale package checks * fix(lit-query): address review feedback for lit examples and lifecycle tests * chore: fix lockfile * fix: add customCondition * docs(lit-query): add Lit docs and generated reference * docs(lit-query): fix Lit docs review comment and align examples --------- Co-authored-by: gauravchugh <gauravchugh@servicenow.com> Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2.3 KiB
| id | title |
|---|---|
| QueryClientProvider | QueryClientProvider |
Class: QueryClientProvider
Defined in: packages/lit-query/src/QueryClientProvider.ts:64
Lit element that provides a QueryClient to descendant Lit Query
controllers through Lit context.
The client is a property, not an attribute. When rendering this element in
a Lit template, bind it with property binding: .client=${queryClient}.
The provider throws if it connects without a client, or if an already
connected provider has its client cleared.
This class is not registered as a custom element by the package. Applications
must register either a subclass or the class itself with
customElements.define.
Examples
import { html, LitElement } from 'lit'
import { QueryClient, QueryClientProvider } from '@tanstack/lit-query'
const queryClient = new QueryClient()
class AppQueryProvider extends QueryClientProvider {
constructor() {
super()
this.client = queryClient
}
}
customElements.define('app-query-provider', AppQueryProvider)
class AppRoot extends LitElement {
render() {
return html`<app-query-provider><todos-view></todos-view></app-query-provider>`
}
}
import { html } from 'lit'
import { QueryClient, QueryClientProvider } from '@tanstack/lit-query'
const queryClient = new QueryClient()
customElements.define('query-client-provider', QueryClientProvider)
const view = html`
<query-client-provider .client=${queryClient}>
<todos-view></todos-view>
</query-client-provider>
`
Extends
LitElement
Constructors
Constructor
new QueryClientProvider(): QueryClientProvider;
Defined in: packages/lit-query/src/QueryClientProvider.ts:82
Returns
QueryClientProvider
Overrides
LitElement.constructor
Properties
client
client: QueryClient;
Defined in: packages/lit-query/src/QueryClientProvider.ts:76
The QueryClient provided to descendant controllers and global fallback
helpers while this provider is connected.
Bind this as a property in Lit templates with .client=${queryClient}.