Skip to content

How to configure throwOnError for @tanstack/react-query #2741

@DavidVollmers

Description

@DavidVollmers

Hey, I am struggling to understand how I can configure throwOnError when using the @tanstack/react-query plugin.

In tanstack react-query the default value of throwOnError is false but when generating query options using hey-api cli I get the following code generated:

export const xxxGetOptions = (options?: Options<xxxData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await xxxGet({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true
            });
            return data;
        },
        queryKey: xxxGetQueryKey(options)
    });
};

which always sets throwOnError to true. There seems to be no way to override this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs info ⏳Further information is required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions