Skip to content

[BUGFIX] fix cellSettings not applied when table column filters are active#688

Open
rajusem wants to merge 2 commits into
perses:mainfrom
rajusem:OBSINTA-1490
Open

[BUGFIX] fix cellSettings not applied when table column filters are active#688
rajusem wants to merge 2 commits into
perses:mainfrom
rajusem:OBSINTA-1490

Conversation

@rajusem

@rajusem rajusem commented Jun 18, 2026

Copy link
Copy Markdown

Summary

Fixes cellSettings conditional formatting (e.g., showing "N/A" for null values) not being applied when column filters are active in the Table panel.

Root cause

cellConfigs was computed by iterating the unfiltered data array and keyed by array index (${index}_${columnKey}). The <Table> component receives filteredData which has different indices after filtering. This caused cellSettings overrides (text, colors) to either not appear or apply to incorrect cells when a filter was active.

Fix

Moved columnFilters state and filteredData memo before the cellConfigs memo, then changed cellConfigs to iterate filteredData instead of data. This ensures cellConfig indices always match the rows the Table renders.

All hooks remain unconditional (early returns are after all hook calls), so React Rules of Hooks are preserved. Sorting is unaffected — TanStack Table preserves row.id from the original data index through getSortedRowModel, so cellConfigs[cell.id] resolves correctly regardless of sort order.

How to reproduce (before fix)

  1. Create a Table panel with multiple queries where some queries return data for a namespace and others don't (e.g., a multi-metric quota table)
  2. Add cellSettings with a Misc/null condition (text: "N/A")
  3. Enable filtering
  4. Verify N/A appears correctly in the unfiltered view
  5. Apply a column filter to show only a row with null values
  6. Bug: N/A text disappears — cells show blank instead

Tests added

  • N/A renders correctly for null values in unfiltered multi-query table
  • N/A persists after filtering to a row with missing data (regression test)
  • Genuine zero values are NOT replaced with N/A (false positive prevention)

Uses ARIA role-based selectors per UI guidelines.

Screenshots

Without filter :
Screenshot 2026-06-18 at 3 12 58 PM
With filter :
Screenshot 2026-06-18 at 11 52 12 AM

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

…ctive

cellConfigs was keyed by row index from the unfiltered `data` array, but
the <Table> component renders `filteredData` which has different indices
after filtering. This caused cellSettings overrides (e.g. "N/A" for null
values) to either not appear or apply to the wrong row.

Fix: compute cellConfigs from `filteredData` instead of `data` by moving
the `columnFilters` state and `filteredData` memo before the `cellConfigs`
memo in the hook order.

Signed-off-by: Raj Zalavadia <rzalavad@redhat.com>
@rajusem rajusem requested a review from a team as a code owner June 18, 2026 10:32
@rajusem rajusem requested review from shahrokni and removed request for a team June 18, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant