Skip to content

feat(table v2): add tooltip to table header#39287

Open
SBIN2010 wants to merge 70 commits into
apache:masterfrom
SBIN2010:feature/add_AgGredTable_tooltip_to_table_header
Open

feat(table v2): add tooltip to table header#39287
SBIN2010 wants to merge 70 commits into
apache:masterfrom
SBIN2010:feature/add_AgGredTable_tooltip_to_table_header

Conversation

@SBIN2010
Copy link
Copy Markdown
Contributor

SUMMARY

This Pr adds to AgGridTable tooltip to table header
As previously added to the table in PR #37179

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Снимок экрана от 2026-04-11 01-40-15

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

SBIN2010 and others added 30 commits October 22, 2024 23:07
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 10, 2026

Code Review Agent Run #0b12a9

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 19151d1..838215a
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/AgGridTable/index.tsx
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/types.ts
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/useColDefs.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the viz:charts:table Related to the Table chart label Apr 10, 2026
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/useColDefs.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.58%. Comparing base (6c88fca) to head (f3a8d39).
⚠️ Report is 75 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39287   +/-   ##
=======================================
  Coverage   64.58%   64.58%           
=======================================
  Files        2564     2564           
  Lines      133560   133565    +5     
  Branches    31032    31035    +3     
=======================================
+ Hits        86256    86267   +11     
+ Misses      45812    45806    -6     
  Partials     1492     1492           
Flag Coverage Δ
javascript 66.54% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 10, 2026

Code Review Agent Run #33c9db

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 838215a..67c3ac4
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/useColDefs.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@pull-request-size pull-request-size Bot added size/L and removed size/S labels Apr 11, 2026
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/test/transformProps.test.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/test/transformProps.test.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/test/transformProps.test.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/test/transformProps.test.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-ag-grid-table/test/transformProps.test.ts Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 11, 2026

Code Review Agent Run #05832d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 67c3ac4..2d73c46
    • superset-frontend/plugins/plugin-chart-ag-grid-table/test/transformProps.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines 348 to +397
@@ -384,6 +385,17 @@ const processColumns = memoizeOne(function processColumns(
? config.currencyFormat
: savedCurrency;

const metricLookupKey = key.startsWith('%') ? key.slice(1) : key;
const description =
rawDatasource.columns?.find(
(item: { column_name?: string; description?: string | null }) =>
item.column_name === key,
)?.description ??
rawDatasource.metrics?.find(
(item: { metric_name?: string; description?: string | null }) =>
item.metric_name === metricLookupKey,
)?.description;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: processColumns is memoized with a custom equality function, but this new logic now depends on rawDatasource and the comparator does not account for rawDatasource.columns/rawDatasource.metrics. When datasource metadata changes (for example, updated column/metric descriptions) while other compared fields stay the same, memoization will incorrectly reuse stale column metadata and tooltip descriptions will not refresh. Include rawDatasource fields in the isEqualColumns comparison (or remove the custom comparator) so description changes invalidate the memoized result. [logic error]

Severity Level: Minor 🧹
- ⚠️ Table V2 header tooltips show outdated column descriptions.
- ⚠️ Dataset metadata edits not reflected until cache invalidation.
Steps of Reproduction ✅
1. Render any Table V2 chart (AgGridTable) so that the plugin's `transformProps` runs with
current chart props. `AgGridTableChartPlugin` registers `transformProps` in
`superset-frontend/plugins/plugin-chart-ag-grid-table/src/index.ts:21-32`, and
`transformProps` calls `processColumns(chartProps)` in
`superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts:676`.

2. On this first render, `processColumns` is executed and computes column metadata,
including descriptions derived from the dataset metadata (`rawDatasource`). This happens
in `superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts:17-31`
(props destructuring including `rawDatasource`) and lines 69-78 where:

   - `const description = …` looks up `rawDatasource.columns` and `rawDatasource.metrics`
   based on the column key and `metricLookupKey`.

   - The resulting `description` is stored on each column object returned from
   `processColumns`.

   These columns (with `description`) are then passed through `transformProps` into the
   chart component.

3. The AG Grid header tooltips for this chart are taken directly from the column
descriptions. In
`superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/useColDefs.ts:212-229`,
`useColDefs` builds column definitions, and `getCommonColProps` returns a `ColDef` with
`headerTooltip: col.description` at `useColDefs.ts:21-25`. Thus, whatever `processColumns`
computed in step 2 is what the user sees as the header tooltip.

4. Still on the same page (same JS runtime), update only the dataset metadata (for
example, change a column or metric description in the dataset editor) and re-run or
refresh the chart so that new `ChartProps` are constructed with an updated `rawDatasource`
but identical values for the fields compared in `isEqualColumns`. The `processColumns`
memoization uses `memoizeOne(..., isEqualColumns)` in
`superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts:17-19` and the
comparator in
`superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/isEqualColumns.ts:22-45`
only checks:

   - `a.datasource.columnFormats`, `a.datasource.currencyFormats`,
   `a.datasource.verboseMap`

   - `a.formData.tableTimestampFormat`, `a.formData.timeGrainSqla`

   - `a.formData.metrics`, `a.queriesData[0].colnames`, `a.queriesData[0].coltypes`

   - `a.formData.extraFilters`, `a.formData.extraFormData`

   - `a.rawFormData.column_config`

   It never inspects `a.rawDatasource` or `b.rawDatasource`. If the query shape and form
   data are unchanged, all these compared fields remain equal even though
   `rawDatasource.columns`/`rawDatasource.metrics` now contain new `description` values.
   `isEqualColumns` returns `true`, so `memoizeOne` reuses the previous `columns` array
   and does not re-run `processColumns`. As a result, `useColDefs` continues to use the
   stale `col.description` values for `headerTooltip`, and the user sees outdated tooltips
   that do not reflect the updated dataset metadata.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts
**Line:** 348:397
**Comment:**
	*Logic Error: `processColumns` is memoized with a custom equality function, but this new logic now depends on `rawDatasource` and the comparator does not account for `rawDatasource.columns`/`rawDatasource.metrics`. When datasource metadata changes (for example, updated column/metric descriptions) while other compared fields stay the same, memoization will incorrectly reuse stale column metadata and tooltip descriptions will not refresh. Include `rawDatasource` fields in the `isEqualColumns` comparison (or remove the custom comparator) so description changes invalidate the memoized result.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@rusackas
Copy link
Copy Markdown
Member

rusackas commented May 13, 2026

Thanks for the contribution! Looks solid — AG Grid's headerTooltip with tooltipShowDelay is the right pattern, and it's great to see a test file included. A few things to consider:

Stale memoization bug (transformProps.ts): processColumns is wrapped in memoizeOne with a custom isEqualColumns comparator that doesn't account for rawDatasource.columns and rawDatasource.metrics fields. If a user updates column/metric descriptions without changing anything else the comparator checks, the memoized result will be stale and tooltips will show outdated values. The fix might be to either extend isEqualColumns to compare rawDatasource.columns/rawDatasource.metrics, or move the description lookup outside the memoized function.

Percent-metric key stripping: The key.startsWith('%') ? key.slice(1) : key logic is might need a short comment explaining the %-prefix convention to help future maintainers.

Otherwise the diff is clean and the feature is a useful parity improvement with the existing table plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/L viz:charts:table Related to the Table chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants