You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "moonming (via GitHub)" <gi...@apache.org> on 2026/07/10 07:24:53 UTC
[PR] fix(settings): debounce the admin-key query refresh [apisix-dashboard]
moonming opened a new pull request, #3422:
URL: https://github.com/apache/apisix-dashboard/pull/3422
## What
The Admin Key field in the settings modal fired `queryClient.invalidateQueries()` + `queryClient.refetchQueries()` on **every keystroke** (inside a bare `setTimeout`). Typing a 32-char admin key = 32 full invalidate+refetch storms of every mounted query, usually against a 401-ing backend. While reviewing this live I captured an 18-request burst of identical `GET /services` calls from one typing session.
## How
- keep the per-keystroke jotai atom update (controlled input; the axios request interceptor reads the atom)
- debounce the query refresh with `useDebouncedCallback` (@mantine/hooks, already a dependency) at 500ms — one refresh when the user pauses, same recovery behavior for paste and for the auth e2e flow
## Verification
- new regression e2e `e2e/tests/regression/settings.admin-key-debounced-refetch.spec.ts`: types the key character-by-character (30ms delay), waits for the request count to settle, asserts the Admin API request count stays far below one-refetch-per-keystroke
- `auth.spec.ts` passes unchanged (fill + reload flow unaffected)
- `pnpm lint` clean, `tsc -b` clean
Found during the review tracked in #3417.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(settings): debounce the admin-key query refresh [apisix-dashboard]
Posted by "moonming (via GitHub)" <gi...@apache.org>.
moonming commented on PR #3422:
URL: https://github.com/apache/apisix-dashboard/pull/3422#issuecomment-4933121648
Post-push audit findings addressed in 947836a6:
- **HIGH (pending refresh cancelled on modal close)** — fixed with `{ delay: 500, flushOnUnmount: true }`; Mantine's numeric-arg form hard-sets `flushOnUnmount: false` and cancels on unmount, so paste-then-close would have left every query in its 401 error state.
- **MEDIUM (spec never verified the refresh fires)** — the spec now requires a successful (`res.ok()`) Admin API response after typing completes; 401-retry noise alone can no longer satisfy it.
- **MEDIUM (tight <8 bound)** — bound is now relative: `adminRequests < adminKey.length` (old behavior ≥ one refetch per keystroke; fixed behavior ~a handful), with real headroom against retry noise.
- **LOW (double-fetch)** — switched to `invalidateQueries({ refetchType: 'none' })` + a single `refetchQueries()`: one fetch per query, still covering observer-less error-state queries that wrong-key recovery depends on.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(settings): debounce the admin-key query refresh [apisix-dashboard]
Posted by "guoqqqi (via GitHub)" <gi...@apache.org>.
guoqqqi merged PR #3422:
URL: https://github.com/apache/apisix-dashboard/pull/3422
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org