Skip to content

chore(webui): complete the TanStack Query migration - #2364

Merged
netomi merged 7 commits into
mainfrom
gnugomez/main/complete-tanstack-migration
Oct 23, 2026
Merged

netomi merged 7 commits into
mainfrom
gnugomez/main/complete-tanstack-migration

Conversation

@gnugomez

@gnugomez gnugomez commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Tanstack Query has proven to be the right direction, and to really add value and reduce boilerplate in the webui.

This PR closes the circle and finishes up the migration of the remaining endpoints that were still using useEffect + abort controllers directly on the components.

The sendRequest methods have been further simplified and the fetch-retry dependency has been dropped. The 429 retries are now handled at the QueryClient level.

@gnugomez
gnugomez added this pull request to stack #2367 October 22, 2026 15:09
…e-tanstack-migration

# Conflicts:
#	webui/CHANGELOG.md
@gnugomez
gnugomez requested a review from netomi October 22, 2026 15:18
@netomi

netomi commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Code review

No blocking bugs found in the core of the change (server-request.ts, query-client.ts, main.tsx, use-main-queries.ts). Not reviewed in depth: the scan-admin context rewrite and the remaining new hooks. Tests and lint were not run.

Points for the author, all non-blocking:

  1. 429 retries are narrower than before. fetch-retry retried every request; now only queries retry a 429 (query-client.ts). Mutations use TanStack's default of no retry, so a rate-limited POST/DELETE (token creation, namespace changes, review submit) now surfaces an error. The code comment says this is intentional, but the PR description and changelog should mention it.
  2. Query-key nesting. ['user','auth-error'] and ['user','csrf'] sit under ['user'], so invalidateQueries(['user']) also refetches them. Harmless today because the CSRF query is uncached, but fragile.
  3. Logged-out detection is implicit. main.tsx treats userError.status === 200 as "nobody is logged in", which depends on sendRequest stamping a 200 error body with its status and the retry rule skipping statuses below 500. An explicit helper next to isNotFound would be safer.
  4. Deprecated shims. sendNonRetriableRequest, controllerFromSignal and abortController are kept. If they are only used internally, drop them; the repo guidance is not to preserve backward compatibility unless asked.

🤖 Generated with Claude Code

…e-tanstack-migration

# Conflicts:
#	webui/CHANGELOG.md
#	webui/src/pages/admin-dashboard/publisher-revoke-dialog.tsx
#	webui/src/pages/user/profile/user-publisher-agreement.tsx
gnugomez and others added 4 commits October 23, 2026 15:01
The registry answers /user/auth-error with a message and code but no
error field, so sendRequest resolved it and a failed login showed no
dialog.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Publishing or deleting a version left the cached detail fresh for a
minute, so the extension page could show the old versions.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Drops sendNonRetriableRequest, controllerFromSignal and the
abortController request field, and tests the retry policy through a
real QueryClient instead of calling its functions directly.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@netomi
netomi merged commit 0029c41 into main Oct 23, 2026
5 checks passed
@netomi
netomi deleted the gnugomez/main/complete-tanstack-migration branch October 23, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants