Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

`getValue` cache not invalidating when `accessorFn` is updated

未關閉
#5,363 4 則留言 12 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@ahmadelsayed97 已經在處理了。

開始於 2026年8月29日。

  • #6556 來自 @ErfanBagheri404 —— 已關閉,未合併
  • #6581 來自 @ahmadelsayed97 —— 未關閉
  • #6613 來自 @boriskozak —— 未關閉

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
react, typescript
領域
frontend

研究方向

從連結的 StackBlitz 重現開始,在 src/main.tsx 中確認變更狀態會更新欄的 accessorFn,而 getValue 仍然回傳快取的值。追蹤 getValue 快取和 accessorFn 更新路徑;當顯示的值重新整理且不變更欄 id 或遺失目前的排序狀態時,修正即完成。

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

描述

TanStack Table version

v8.12.0

Framework/Library version

React v18.2.0

Describe the bug and the steps to reproduce it

When the accessorFn for a column is updated to return a new value, the new value is never displayed in the table. Through a sophisticated series of console.logs, I discovered that when getValue is called on the rerender, the new accessorFn is never called, presumably due to caching on column id.

The use case is a column that displays the name of the person for the current row. We want the user to be able to choose whether to display first or last name first (e.g. Tanner Linsley or Linsley, Tanner). We could just change the column id when the accessorFn is updated, but then we lose the current sort state for that column, ie if the table is currently sorted by name, we want to stay sorted by name after the name format is changed.

Steps to reproduce:

  1. Define a column where the accessorFn returns a different value based on some piece of state
  2. Update that piece of state
  3. The values in the column don't change
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/tanstack-table-rnjqkx?file=src%2Fmain.tsx

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

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
星號
28.5k
分支
3.6k
平均合併
17 小時 39 分鐘
30 天內合併 PR
10

環境準備

從這裡開始

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

TanStack/table 的其他 Issue

查看 TanStack/table 的全部 Issue

相似的 Issue

更多 TypeScript Issue

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

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