Svelte onChange stops firing after a partial setOptions update
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 68/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, typescript
- 領域
- frontend
研究方向
從 packages/svelte-virtual/src/ 下的 Svelte 適配器原始碼開始,createVirtualizer 和 createWindowVirtualizer 會在此合併選項並重新建立 store 訂閱。執行連結的再現(在 StackBlitz/repo 中執行 npm install && npm start),觀察 onChange 計數器在 setOptions({ count: 110 }) 之後停止,然後檢查部分更新在重建 store 時是否會丟棄現有的 onChange。完成意味著兩個建構函式在部分更新後再次觸發 onChange,並由再現與該套件的測試驗證。
由索引模型根據 Issue 內容生成。
描述
Describe the bug
After calling setOptions({ count: 110 }), an existing onChange callback stops firing. The store still updates. This affects both createVirtualizer and createWindowVirtualizer.
Your minimal, reproducible example
https://github.com/clean99/virtual-svelte-onchange-repro (StackBlitz: https://stackblitz.com/github/clean99/virtual-svelte-onchange-repro)
Its reproduce.mjs needs only @tanstack/[email protected] and [email protected]. Run npm install and npm start. It uses the public measure() method to trigger a state-change notification, without rendering a component or relying on browser timing.
Steps to reproduce
- Create a Svelte virtualizer with
count: 100,estimateSize: () => 40,getScrollElement: () => null, and anonChangecounter. Subscribe to its store. - Call
measure(): the counter becomes 1. - Call
setOptions({ count: 110 }), thenmeasure()again. - The counter stays at 1 instead of becoming 2. The reproduction asserts this for both exported constructors.
Expected behavior
An omitted option should remain unchanged in a partial update. The existing onChange callback should still fire when virtualizer state changes, as described in the API reference.
How often does this bug happen?
Every time.
Screenshots or Videos
Not applicable; the reproduction checks callback invocations directly.
Platform
macOS 26.5.2, Node.js 24.16.0. No browser is needed for this reproduction.
tanstack-virtual version
@tanstack/svelte-virtual 3.13.49, Svelte 4.2.20.
TypeScript version
The reproduction is JavaScript. The regression tests use TypeScript 5.9.3.
Additional context
The Svelte infinite-scroll example uses a count-only update after fetching another page. Adding an onChange callback to that pattern loses the callback after the update.
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct.
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- 主要語言
- TypeScript
- 星號
- 7.2k
- 分支
- 479
- 平均合併
- 21 小時 1 分鐘
- 30 天內合併 PR
- 41
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/virtual 的其他 Issue
-
anchorTo: 'end' loses the end when the scroll element shrinks可能已有人在做 @langleyd 於 22 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 68/100
維護者通常 1 天內回覆
-
marko-virtual: scrollToEnd during an in-flight prepend strands the view one prepend above the bottom (chat-pretext e2e fails on CI)可能已有人在做 @prayaggaikwad96 於 16 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 55/100
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 42/100
TanStack/virtual#1252 · 2 則留言 ·
維護者通常 1 天內回覆
-
eslint-plugin-react-hooks v7 warning for useVirtualizer: Compilation Skipped: Use of incompatible library可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 4/5 3-5 天 新手友好度 45/100
TanStack/virtual#1119 · 11 則留言 · 32 個 reaction ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 35/100
TanStack/virtual#1099 · 1 個 reaction ·
維護者通常 1 天內回覆
相似的 Issue
-
area:desktop area:ui bug platform:macos
難度 2/5 1-3 小時 新手友好度 67/100
anthropics/claude-code#106183 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
feature:App-Tour feature:Chat ready Web
難度 2/5 1-3 小時 新手友好度 62/100
digitalfabrik/integreat-app#4523 · 2 個 reaction ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
Required Lexical field accepts two empty paragraphs可能已有人在做 @lazerg 今天認領。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 76/100
payloadcms/payload#19222 ·
維護者通常 1 天內回覆