Document the indexAttribute option and cover it with a test

未關閉 適合新手
#1,386 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@officialasishkumar 已經在處理了。

開始於 2026年11月20日。

  • #1387 來自 @officialasishkumar —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript

研究方向

從 docs/api/virtualizer.md 和 docs/framework/marko/marko-virtual.md 中現有的 indexAttribute 項目開始,接著檢查 packages/virtual-core/tests,了解核心虛擬器的測試模式。說明預設值、measureElement 和 resize observer 對它的使用方式,以及共用元素的網格情境;新增一個測試,其中列虛擬器和欄虛擬器使用不同的屬性。文件和測試涵蓋要求的行為後,即視為完成。

由索引模型根據 Issue 內容生成。

描述

Describe the bug

The indexAttribute option of Virtualizer (default 'data-index') is public API in VirtualizerOptions and is documented only for the Marko adapter. It is missing from docs/api/virtualizer.md, so nothing on the core options page explains how to measure the same element with two virtualizers (for example a row and a column virtualizer in a grid). Without it, both virtualizers read the same data-index attribute and the second one measures the wrong index.

There is also no test in packages/virtual-core/tests that exercises a custom indexAttribute, so the behavior could regress unnoticed.

Your minimal, reproducible example

Search the docs for indexAttribute: it only appears in docs/framework/marko/marko-virtual.md.

Steps to reproduce
  1. Open docs/api/virtualizer.md.
  2. Look for indexAttribute among the options.
Expected behavior

The option is documented with its default, how it is used by measureElement and the resize observer, and the two-virtualizer grid use case. A core test covers a row and a column virtualizer measuring one shared element through distinct attributes.

How often does this bug happen?

Every time

Platform

Any

tanstack-virtual version

@tanstack/virtual-core 3.19.11 (main)

Additional context

Docs and test only; no published code changes.

主要語言
TypeScript
星號
7.2k
分支
495
平均合併
15 小時 11 分鐘
30 天內合併 PR
17

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TanStack/virtual 的其他 Issue

查看 TanStack/virtual 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。