Skip to content

Add errors-allowed version of apiq and use it everywhere#2879

Merged
david-crespo merged 1 commit into
mainfrom
apiq-errors-allowed
Aug 12, 2025
Merged

Add errors-allowed version of apiq and use it everywhere#2879
david-crespo merged 1 commit into
mainfrom
apiq-errors-allowed

Conversation

@david-crespo

@david-crespo david-crespo commented Aug 12, 2025

Copy link
Copy Markdown
Collaborator

Because there are only a few uses of useApiQueryErrorsAllowed, it's trivial to convert them all to the new preferred format that lets use vanilla useQuery.

Note this leaves in place apiQueryClient.prefetchQueryErrorsAllowed, which is only used in one spot, but I don't feel like figuring out how to reconcile the slight difference in logic right now.

console/app/api/hooks.ts

Lines 320 to 335 in 777a959

/**
* Loader analog to `useApiQueryErrorsAllowed`. Prefetch a query that can
* error, converting the error to a valid result so RQ will cache it.
*/
prefetchQueryErrorsAllowed: <M extends string & keyof A>(
method: M,
params: Params<A[M]>,
options: FetchQueryOtherOptions<ErrorsAllowed<Result<A[M]>, ApiError>> & {
/**
* HTTP errors will show up unexplained in the browser console. It can be
* helpful to reassure people they're normal.
*/
explanation: string
expectedStatusCode: 403 | 404
}
) =>

@vercel

vercel Bot commented Aug 12, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Updated (UTC)
console Ready Preview Aug 12, 2025 4:42pm

@david-crespo david-crespo merged commit 76ca8cf into main Aug 12, 2025
7 checks passed
@david-crespo david-crespo deleted the apiq-errors-allowed branch August 12, 2025 17:33
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.

1 participant