Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#11,586 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
40/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
angular, typescript
领域
frontend, testing

调研方向

Examine the Angular Query integration, specifically the toResource() helper and its interaction with Signal Forms' validateAsync debounce. Start by reviewing the provided StackBlitz example to see the error in action. Look at the relevant source files for toResource and the Signal Forms integration. Understand how debounced validation triggers a LOADING state and why it causes a console error. Check the existing tests for toResource and validation to see if they cover this scenario.

由索引模型根据 Issue 内容生成。

描述

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 https://github.com/TanStack/query/discussions/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.

主要语言
TypeScript
星标
50.3k
派生
4.2k
平均合并
22 小时 33 分钟
30 天内合并 PR
214

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/query 的其他 Issue

查看 TanStack/query 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。