Repository navigation
refactor: admin pages on TanStack Query with the generated query options - #331
Merged
Merged
Conversation
The admin stores and pages now read through createQuery and write through createMutation, using the options the hey-api TanStack plugin generates. Polling is refetchInterval, writes invalidate or refetch what they change, and pollWhileVisible and the pagination factory are gone. The saga list takes a search parameter that matches saga ID, name, execution ID or error message on the server, so the search box covers every page instead of filtering the current one. Queries don't retry yet, since the fetch interceptor toasts every failure. Moving the toasts into the query cache and the rest of the app comes next under #326.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Part of #326. The admin pages now get their server state from TanStack Query, through the options the hey-api
@tanstack/svelte-queryplugin generates.Sagas, executions, events, users and system settings read with
createQueryand write withcreateMutation. Polling isrefetchInterval, so it pauses in a hidden tab, and every filter is its own cache key, so a slow poll can't overwrite newer results. Writes invalidate what they change. pollWhileVisible and the pagination factory are deleted. Browsing events is a POST, so agetKindhook in openapi-ts.config.ts generates it as a query.The saga search used to filter only the current page while the total counted all of them.
GET /api/v1/sagas/now takessearch, an escaped case-insensitive match on saga ID, name, execution ID and error message, and the page sends it.Queries don't retry yet. The fetch interceptor still toasts every failed request, so each retry would toast again. Moving the toasts into the query cache, turning retries on and the rest of the app (editor, settings, notifications, auth) come in the next PR.
The global test mock moved from the API index to sdk.gen.ts so the generated options call the mocks, and
renderWithQueryClientandcreateInQueryContextgive components and stores a query client. Vitest passes 1122 tests with coverage at 95.1/79.5/94.5/95.5, and backend unit, ruff, mypy and the orphan check pass. The non-k8s e2e suite passes except the 19 known k3s-only tests and the new saga search route test, which uses the same pod-created helper; the new service-level search test passes. I also ran the built frontend against a local backend in Chrome and went through all five admin pages.Summary by cubic
Moves all five admin pages' server state to TanStack Query, using the options the hey-api
@tanstack/svelte-queryplugin generates. Reads usecreateQueryand writes usecreateMutation; polling is nowrefetchInterval, which pauses in hidden tabs, and each filter is its own cache key, so a slow poll can't overwrite newer results. This removespollWhileVisibleand the pagination factory, and the admin stores no longer track their own loading, polling, or pagination state. Writes invalidate what they change. Queries don't retry yet — the fetch interceptor toasts every failed request, so a retry would toast again; moving the toasts into the query cache and converting the rest of the app come in a follow-up.The saga search previously filtered only the current page while the total counted all sagas.
GET /api/v1/sagas/now takessearch, an escaped case-insensitive match on saga ID, name, execution ID, and error message, so search applies across all pages.Browsing events is a read sent as POST, so a
getKindhook inopenapi-ts.config.tsgenerates it as a query. New test helpersrenderWithQueryClientandcreateInQueryContextwrap components and stores in a query client, and the global API mock moved from the API index tosdk.gen.tsso the generated options call the mocks.Written for commit 8754639. Summary will update on new commits.