[BUGFIX] fix cellSettings not applied when table column filters are active#688
Open
rajusem wants to merge 2 commits into
Open
[BUGFIX] fix cellSettings not applied when table column filters are active#688rajusem wants to merge 2 commits into
rajusem wants to merge 2 commits into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
cellSettingsconditional formatting (e.g., showing "N/A" for null values) not being applied when column filters are active in the Table panel.Root cause
cellConfigswas computed by iterating the unfiltereddataarray and keyed by array index (${index}_${columnKey}). The<Table>component receivesfilteredDatawhich 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
columnFiltersstate andfilteredDatamemo before thecellConfigsmemo, then changedcellConfigsto iteratefilteredDatainstead ofdata. 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.idfrom the original data index throughgetSortedRowModel, socellConfigs[cell.id]resolves correctly regardless of sort order.How to reproduce (before fix)
cellSettingswith aMisc/nullcondition (text: "N/A")Tests added
Uses ARIA role-based selectors per UI guidelines.
Screenshots
Without filter :


With filter :
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.