()
| 372 | } |
| 373 | |
| 374 | render() { |
| 375 | const query = this.projectsQuery() |
| 376 | const projects = query.data?.projects ?? [] |
| 377 | const hasMore = query.data?.hasMore ?? false |
| 378 | const createProject = this.createProjectMutation() |
| 379 | const favoriteProject = this.favoriteMutation() |
| 380 | |
| 381 | return html` |
| 382 | <main> |
| 383 | <h1>TanStack Lit Query Pagination Demo</h1> |
| 384 | <p> |
| 385 | Pagination + mutation demo with optimistic favorite toggles, |
| 386 | invalidation, and deterministic server failures. |
| 387 | </p> |
| 388 | |
| 389 | <section> |
| 390 | <div data-testid="query-status">query: ${query.status}</div> |
| 391 | <div data-testid="is-fetching"> |
| 392 | isFetching: ${query.isFetching ? 'yes' : 'no'} |
| 393 | </div> |
| 394 | <div data-testid="is-placeholder"> |
| 395 | isPlaceholderData: ${query.isPlaceholderData ? 'yes' : 'no'} |
| 396 | </div> |
| 397 | <div data-testid="current-page">page: ${this.page}</div> |
| 398 | <div data-testid="response-page"> |
| 399 | response-page: ${query.data?.page ?? '-'} |
| 400 | </div> |
| 401 | <div data-testid="has-more">has-more: ${hasMore ? 'yes' : 'no'}</div> |
| 402 | <div data-testid="total-projects"> |
| 403 | total-projects: ${query.data?.totalProjects ?? 0} |
| 404 | </div> |
| 405 | <div data-testid="total-request-count"> |
| 406 | total-requests: ${query.data?.requestMeta.totalRequestCount ?? 0} |
| 407 | </div> |
| 408 | <div data-testid="page-request-count"> |
| 409 | page-requests: ${query.data?.requestMeta.pageRequestCount ?? 0} |
| 410 | </div> |
| 411 | <div data-testid="total-mutation-count"> |
| 412 | total-mutations: ${query.data?.requestMeta.totalMutationCount ?? 0} |
| 413 | </div> |
| 414 | <div data-testid="prefetch-status"> |
| 415 | prefetch: ${this.prefetchStatus} |
| 416 | </div> |
| 417 | </section> |
| 418 | |
| 419 | ${query.isError |
| 420 | ? html`<p data-testid="query-error">${String(query.error)}</p>` |
| 421 | : null} |
| 422 | ${this.resetError |
| 423 | ? html`<p data-testid="reset-error">${this.resetError}</p>` |
| 424 | : null} |
| 425 | |
| 426 | <section> |
| 427 | <label for="delayInput">Delay (ms)</label> |
| 428 | <input |
| 429 | id="delayInput" |
| 430 | data-testid="delay-input" |
| 431 | type="number" |
nothing calls this directly
no test coverage detected