Skip to content

useErrorBoundary option works in useQueries? #2395

@luizeboli

Description

@luizeboli

Discussed in #2355

Originally posted by luizeboli June 8, 2021
Hello guys, I have this hook:

export const useOptions = () => {
  return useQueries([
    {
      queryKey: 'groups',
      queryFn: () => axios({ method: 'GET', url: '/groups' }),
      useErrorBoundary: true,
    },
    {
      queryKey: 'types',
      queryFn: () => axios({ method: 'GET', url: '/types' }),
      useErrorBoundary: true,
    },
    {
      queryKey: 'sourcedTypes',
      queryFn: () => axios({ method: 'GET', url: '/sourcedTypes' }),
      useErrorBoundary: true,
    },
  ])
}

The component that consumes this hook is wrapped by a ErrorBoundary, but it doesn't throw while using useQueries. It just works with useQuery.

The only change needed to work correctly is replace useQueries by useQuery.

Is this an expected behavior? I didn't find it in docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions