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

devtools

它能做什么

这项技能展示如何把 Angular 表格注册到 TanStack Devtools 面板中,使开发者在调试时能看到它们。内容涵盖设置、必需的键和清理。

适用场景

  • ✓当你想在开发模式下运行应用时检查 Angular 表格的状态的时候。
  • ✓当开发者工具面板没有显示某个表格,你需要检查其注册情况的时候。
  • ✓当你希望开发者工具只在开发构建中启用的时候。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我如何让 Angular 表格在开发时显示在 TanStack 开发者工具面板中?”

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

工作原理

它解释如何在 Angular 组件中调用注册辅助函数,为每个表格提供唯一的键,并开启或关闭注册。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

This skill builds on @tanstack/table-core#core and @tanstack/table-devtools#devtools.

Setup

import { Component } from '@angular/core'
import { injectTable, tableFeatures } from '@tanstack/angular-table'
import { injectTanStackTableDevtools } from '@tanstack/angular-table-devtools'

const features = tableFeatures({})
const columns = [{ accessorKey: 'id' }]
const data: Array<{ id: string }> = []

@Component({ selector: 'users-table', template: 'Users table registered' })
export class UsersTable {
  readonly table = injectTable(() => ({
    key: 'users-table',
    features,
    columns,
    data,
  }))

  constructor() {
    injectTanStackTableDevtools(() => ({ table: this.table }))
  }
}

Provide the Angular TanStack Devtools host once at application configuration level as documented in docs/devtools.md.

Hooks and Components

The injector options function may return table: undefined or an enabled function to remove/disable registration reactively.

Common Mistakes

CRITICAL Injector called outside context

Wrong: call injectTanStackTableDevtools from an arbitrary callback after bootstrap.

Correct: call it in a component/service field initializer or constructor injection context.

The adapter uses Angular injection and effects for lifecycle cleanup.

Source: TanStack/table:packages/angular-table-devtools/src/injectTanStackTableDevtools.ts

HIGH Missing table key

Wrong: register an otherwise valid table without options.key.

Correct: assign a stable unique key before injection registration.

Core registration logs an error and skips keyless targets.

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

MEDIUM isDevMode no-op misunderstood

Wrong: expect default Angular exports to render production Devtools.

Correct: keep standard setup development-only; use /production only when explicitly requested.

The package index switches exports using Angular isDevMode().

Source: TanStack/table:packages/angular-table-devtools/src/index.ts

API Discovery

Inspect node_modules/@tanstack/angular-table-devtools/dist/index.d.ts and injectTanStackTableDevtools.d.ts for current injection options.

常见问题

注册代码必须放在哪里?

它必须在 Angular 注入上下文中运行,例如组件字段或构造函数中。

为什么每个表格都需要一个键?

选项要求提供键,这样才能在开发者工具面板中识别每个表格。

应用还需要额外的设置吗?

需要,正如文档所述,开发者工具宿主必须在应用配置层级提供一次。

详情

作者的原始描述

Register Angular Table v9 instances with injectTanStackTableDevtools inside injection context. Load for reactive table registration, required options.key, enabled or undefined tables, cleanup, Angular isDevMode gating, or explicit production exports.

repo: TanStack/table

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能