Angular query: Optimistic updates are not synchronous
@arnoud-dv がすでに取り組んでいます。
2025年10月21日 から。
評価
この issue はまだ評価されていません。
説明
Describe the bug
Here's a stackblitz that repro's the issue about 20% of the time (I think it's timing related): https://stackblitz.com/edit/stackblitz-starters-hn17w1mv?file=src%2Fmain.ts,src%2Findex.html
If you click "edit" and change the "whatever" to just "1", then tab out to trigger blur, you'll see the "whatever" show up for 1 frame. I think this is happening because the optimistic update (which should set the title to "1") is not happening until the next frame. So when I set the "isEditingTitle" signal to false, it flickers the old title for 1 frame. I would expect the optimistic update to be immediate and synchronous, like how normal signals behave, so this flicker never happens.
Generally speaking, this can happen whenever you have a UX that let's the user preview an edit before committing it. In this case, the preview is the input text box, and commiting it is blurring. It would be even more noticeable if the input field looked exactly like the non-editing text.
What are people's thoughts on this? Is this not a use case many encounter?
Your minimal, reproducible example
Steps to reproduce
- Click the "edit" button
- Change "whatever" to just "w"
- Press Tab to trigger blur and finish editing.
Expected behavior
20% of the time, you'll see "whatever" show up for 1 frame. Desired behavior: I would expect the optimistic update to immediately take effect, and the text immediately shows "w".
How often does this bug happen?
Sometimes
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Google Chrome, Version 141.0.7390.54 (Official Build) (arm64)
Tanstack Query adapter
angular-query
TanStack Query version
^5.69.1
TypeScript version
^5.6.3
Additional context
No response
- 主要言語
- TypeScript
- スター
- 50.3k
- フォーク
- 4.2k
- 平均マージ
- 22時間 33分
- マージ済み PR(30日)
- 214
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/query のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 40/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
bcgov/bc-wallet-mobile#4761 · コメント 1 件 ·
-
external-issue to-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100