跳到正文
Skillpedia
网站与界面(前端)29k · #9839

devtools

它能做什么

这项技能解释如何把 TanStack Table 实例连接到 Devtools 面板中,使开发者能检查它们的选项、状态和行。内容涵盖各框架通用的注册步骤。

适用场景

  • ✓当某个表格没有出现在开发者工具面板中,你需要修复连接的时候。
  • ✓当你在使用受支持的框架开发时,需要检查表格的状态和行的时候。
  • ✓当你想确保开发者工具只限于开发构建中使用的时候。

技能链接

https://github.com/TanStack/table/blob/main/packages/table-devtools/skills/devtools/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/TanStack/table/blob/main/packages/table-devtools/skills/devtools/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我怎样把 TanStack 表格注册到开发者工具中,以便查看它的行和状态?”

每周 5 个新技能,1 分钟读完。

工作原理

它解释每个表格都需要唯一的键,框架钩子会替你处理注册,而默认的开发者工具入口在开发环境之外不会做任何事情。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Setup

Framework adapters should use their lifecycle hook or injector. The framework-neutral registration primitive is:

import { constructTable, tableFeatures } from '@tanstack/table-core'
import { storeReactivityBindings } from '@tanstack/table-core/store-reactivity-bindings'
import { upsertTableDevtoolsTarget } from '@tanstack/table-devtools'

const features = tableFeatures({
  coreReactivityFeature: storeReactivityBindings(),
})

const table = constructTable({
  key: 'users-table',
  features,
  columns: [],
  data: [],
})

const cleanup = upsertTableDevtoolsTarget({ table })
cleanup()

Core Patterns

Give every live table a descriptive unique key

The non-empty options.key is both registry identity and panel label. Use stable application identity, not an array index.

Let adapter lifecycles own registration

React/Preact/Solid/Vue hooks and the Angular injector register and clean up at the correct time. Use core target functions only for unsupported frameworks or infrastructure code.

Keep ordinary Devtools development-only

Default entrypoints export no-op panels/plugins outside development. Use /production only when the application explicitly chooses production inspection and its security/bundle implications.

Common Mistakes

HIGH Missing key skips registration

Wrong: register a table whose options.key is absent or whitespace.

Correct: set a stable value such as key: 'billing-invoices' before registration.

The registry logs the missing-key error and returns without adding a target.

Source: TanStack/table:packages/table-devtools/src/tableTarget.ts

HIGH Two tables share one key

Wrong: use key: 'table' for simultaneous tables.

Correct: use unique domain identities such as users-table and orders-table.

Upserting a different table under an existing key replaces that registration.

Source: TanStack/table:packages/table-devtools/src/tableTarget.ts

MEDIUM Production panel expected by default

Wrong: debug why the normal entrypoint renders nothing in production.

Correct: keep Devtools development-only unless production inspection was explicitly requested; then import the documented /production entrypoint.

Default production exports intentionally use no-op implementations.

Source: TanStack/table:docs/devtools.md

API Discovery

Inspect node_modules/@tanstack/table-devtools/dist/index.d.ts, tableTarget.d.ts, and production.d.ts. Framework registration belongs to the matching @tanstack/<framework>-table-devtools package.

常见问题

为什么我的表格没有显示?

这项技能说明,缺少键或键为空的表格会被跳过,因此每个表格都需要唯一的键。

我可以在生产环境中使用开发者工具吗?

只有在你选择明确的生产入口时才可以,但这会带来安全和打包体积方面的影响。

我需要自己调用注册函数吗?

通常不需要。框架钩子或注入器会处理注册和清理,原始函数是为不受支持的框架准备的。

详情

作者的原始描述

Register TanStack Table targets and inspect options, state, features, columns, rows, and row models with @tanstack/table-devtools. Load for missing connections, required unique table options.key, target replacement/cleanup, or an explicit request for production Devtools entrypoints.

repo: TanStack/table

热度

GitHub 星标
29k
排名
#9839
许可证
MIT
更新时间
2026/10/21

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能