Skip to content

[angular-query] toResource causes console error with debounced validation #11586

Description

@ThiloAschebrock

Describe the bug

First, thank you for publishing the stable Angular Query RC and for adding the new toResource() integration in #11516.

I found an issue when using toResource(injectQuery(...)) with Signal Forms validateAsync() and its debounce option. While the debounce is pending, Angular reports the following global console error:

ERROR ResourceParamsStatus: LOADING

The query itself succeeds and validation completes. The error occurs while the debounced validator parameter is loading.

Removing the debounce option from validateAsync makes the console error disappear.

This seems related to the Signal Forms integration discussed in #10788. The current design of this helper might need to be reconsidered so that it can better support this use case as well.

Your minimal, reproducible example

https://stackblitz.com/edit/stackblitz-starters-rq6qsn9u?file=src%2Fmain.ts

Steps to reproduce

  1. Run the example.
  2. Type any value into the  input.
  3. Observe the browser console while the 200 ms debounce is pending.

Expected behavior

The validator should enter its pending state and then resolve without reporting a global error.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • @angular/core :  22.1.7 
  • Browser: Chromium
  • Operating system: macOS

Tanstack Query adapter

angular-query

TanStack Query version

v5.0.0-rc.0

TypeScript version

6.0.2

Additional context

The traditional approach to define a resource using

resource({
    params,
    loader: ({ params }) => queryClient.query(options(params)),
})

works due to loader only executing once the params are available.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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