Route inline /api fetch calls through the client service layer (#2838)#2865
Merged
Conversation
…ine fetch Completes the #2838 sweep: useTheme was the last inline fetch('/api/...') outside client/src/services. Both calls pass { silent: true } since the hook already degrades to the localStorage theme and warns on its own, and the GET's abort guard now also checks controller.signal.aborted because request() collapses an aborted fetch into a generic error.
atomantic
force-pushed
the
claim/issue-2838
branch
from
July 22, 2026 14:38
07a14d6 to
66823ea
Compare
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.
Summary
Routes inline
fetch('/api/...')calls through the documentedclient/src/services/layer, per the/do:betteraudit (issue #2838).client/src/services/apiPrompts.js— wraps the Prompt Manager's 13+ raw/api/prompts*calls (stage templates, variables, job-skill templates). Registered in theapi.jsbarrel and added as a row inservices/README.md. The/api/providerslist these surfaces need reuses the existingapiProviders.getProvidersrather than re-wrapping the endpoint.client/src/pages/PromptManager.jsx— all inline fetches now call theapiPromptshelpers. Custom error toasts pass{ silent: true }to avoid double-toasting.client/src/pages/ImageGen.jsx—flux2-status,hf-token-status, and the multipartimage-gen/generatefetch route through new/extendedapiImageVideo.jshelpers (getFlux2Status,getHfTokenStatus({ signal }),generateImageMultipart).client/src/components/settings/LocalSetupPanel.jsx—setup/check,setup/python,setup/create-venvroute through newapiImageVideo.jshelpers (checkImageGenSetup,detectImageGenPython,createImageGenVenv). These usefetch()inside the service (notrequest()) so the panel's intentionalAbortErrorhandling is preserved —request()collapses abort into a generic error.client/src/components/writers-room/StagePromptModelPicker.jsx— routes throughapiPrompts.getPrompt/savePromptandapiProviders.getProviders.client/src/components/apps/tabs/GsdTab.jsx— routes through existinggetAppDocuments/getGsdProject/getGsdPhases(the first two gained anoptionsparam so callers can pass{ silent: true }).client/src/hooks/useTheme.js— the settings read/write route throughapiSystem.getSettings/updateSettingswith{ silent: true }(the hook already degrades to the localStorage theme and warns on its own). The GET's abort guard also checkscontroller.signal.aborted, sincerequest()collapses an aborted fetch into a generic error.Behavior is preserved throughout (silent-vs-toast conventions, optimistic rollback, abort handling).
Sweep completeness
grepoverclient/src/{pages,components,hooks,lib,utils}now finds no inline/api/fetchoutsideclient/src/services/.VideoGen.jsx's site — carved out of this issue's scope — was already routed through a service wrapper by the VideoGen split (#2834), so nothing is left deferred. The few remaining rawfetch()calls live insideservices/by design, where the caller needsAbortErroror streaming semantics thatrequest()collapses.Test plan
cd client && npm test— 417 files / 4568 tests pass.codex review --base origin/main— no findings.Closes #2838