MCPcopy Create free account
hub / github.com/TanStack/query / Page

Class Page

packages/angular-query/src/__tests__/inject-queries.test.ts:234–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 const results: Array<Array<Record<string, any>>> = []
233
234 @Component({
235 template: `
236 <div>
237 <div>
238 data1: {{ queries()[0].data() ?? 'null' }}, data2:
239 {{ queries()[1].data() ?? 'null' }}
240 </div>
241 </div>
242 `,
243 changeDetection: ChangeDetectionStrategy.OnPush,
244 })
245 class Page {
246 toString(val: any) {
247 return String(val)
248 }
249 queries = injectQueries(() => ({
250 queries: [
251 {
252 queryKey: key1,
253 queryFn: () => sleep(10).then(() => 1),
254 },
255 {
256 queryKey: key2,
257 queryFn: () => sleep(100).then(() => 2),
258 },
259 ],
260 }))
261
262 _pushResults = effect(() => {
263 const snapshot = this.queries().map((q) => ({ data: q.data() }))
264 results.push(snapshot)
265 })
266 }
267
268 const rendered = await render(Page, {
269 providers: [

Callers

nothing calls this directly

Calls 4

injectQueriesFunction · 0.90
sleepFunction · 0.90
refetchMethod · 0.80
ComponentFunction · 0.50

Tested by

no test coverage detected