`getValue` cache not invalidating when `accessorFn` is updated
维护者通常 1 天内回复
@ahmadelsayed97 已经在做这个了。
开始于 2026年8月29日。
评估
- 难度
- 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:
- Define a column where the
accessorFnreturns a different value based on some piece of state - Update that piece of state
- 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
- 平均合并
- 19 小时 40 分钟
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/table 的其他 Issue
-
Issue template renders `react-table`, not `TanStack/table`可能已有人在做 @vishruthasgowda 于 14 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
[svelte] createTableHook: App* wrappers call setContext in the parent's component context (set_context_after_init when showing a column)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 38/100
维护者通常 1 天内回复
-
Cast required to access custom options when defining a custom plugin/feature可能已有人在做 @sorena-paydar 于 15 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
`aggregatedCell` not typed against bound `cellComponents` in `createAppColumnHelper`可能已有人在做 @cpruijsen 于 26 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
ble-needs-fable-review bug mobile priority:P2
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
ColeMurray/background-agents#2305 ·
维护者通常 1 天内回复
-
bug from-studio
难度 2/5 1-3 小时 新手友好度 63/100
esengine/DeepSeek-Reasonix#12355 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
oblien/openship#1086 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复