Skip to content

fix(fleet): show default Running filter as selected on matrix toolbar#196

Merged
TerrifiedBug merged 1 commit intomainfrom
fix/matrix-default-filter-casing
Apr 28, 2026
Merged

fix(fleet): show default Running filter as selected on matrix toolbar#196
TerrifiedBug merged 1 commit intomainfrom
fix/matrix-default-filter-casing

Conversation

@TerrifiedBug
Copy link
Copy Markdown
Owner

@TerrifiedBug TerrifiedBug commented Apr 28, 2026

Summary

Fixes Notion bug: "Add default running filter for deployment matrix on fleet/overview page (still not working)".

The default filter **was** being applied (matrix rows were filtered correctly), but the toolbar chip rendered unselected, so the user perceived no filter at all.

Root cause

`useMatrixFilters` returns the default status as `["running"]` (lowercase). `DeploymentMatrixToolbar` defines its chip ids as `["Running", "Stopped", "Crashed"]` (capitalized). The chip selection check is `statusFilter.includes(opt.id)`, which is case-sensitive — `"Running"` !== `"running"` so the chip stayed unhighlighted.

The page-level filter logic uppercases both sides (`s.toUpperCase()`) before comparing against `aggregateProcessStatus` output, so the actual filtering worked. Just the visual feedback was broken.

Fix

Align casing: `DEFAULT_STATUS_FILTER: ["Running"]`.

Test plan

  • Visit `/fleet/overview` with no URL params → "Running" chip in toolbar is highlighted by default
  • Matrix shows only running pipelines (unchanged behavior)
  • Click chip to deselect → matrix shows all statuses
  • Existing `use-matrix-filters` test passes with updated expectation

Greptile Summary

This PR fixes a UI mismatch where the default "Running" status filter chip appeared unselected on initial page load. The root cause was a casing discrepancy: DEFAULT_STATUS_FILTER used "running" (lowercase) while MATRIX_STATUS_OPTIONS chip IDs are "Running" (capitalized), causing the case-sensitive statusFilter.includes(opt.id) check to fail. The fix aligns the default casing with the chip IDs; filtering logic on the page continues to work correctly because it already normalises both sides with .toUpperCase() before comparing against aggregateProcessStatus output.

Confidence Score: 5/5

Safe to merge — minimal one-line fix with no risk of regression.

Single constant value change that aligns casing between the hook default and the toolbar chip IDs. Filtering logic is unaffected because the page already normalises with .toUpperCase(). Test is correctly updated. No security, data, or logic concerns.

No files require special attention.

Important Files Changed

Filename Overview
src/hooks/use-matrix-filters.ts Changed DEFAULT_STATUS_FILTER value from "running" to "Running" to match the capitalized chip IDs in DeploymentMatrixToolbar; no other logic changed.
src/hooks/tests/use-matrix-filters.test.ts Test expectation updated from "running" to "Running" to match the new default; correctly reflects the changed behaviour.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["useMatrixFilters\nstatusParam === null"] -->|"DEFAULT_STATUS_FILTER"| B["statusFilter = ['Running']"]
    B --> C["DeploymentMatrixToolbar\nstatusFilter.includes(opt.id)"]
    C -->|"'Running' === 'Running' ✅"| D["Chip renders SELECTED\n(bg-accent)"]
    B --> E["fleet/overview page\nmatrixStatusFilter.map(s => s.toUpperCase())"]
    E -->|"'RUNNING'.includes(agg) ✅"| F["Matrix rows filtered correctly"]
Loading

Reviews (1): Last reviewed commit: "fix(fleet): align deployment-matrix defa..." | Re-trigger Greptile

The matrix default status filter was "running" (lowercase) while the
toolbar status chips use ids "Running"/"Stopped"/"Crashed" (capitalized).
The page-level filter logic uppercases both sides before comparing, so
matrix rows were correctly filtered, but the "Running" chip rendered as
unselected because statusFilter.includes(opt.id) is case-sensitive.

User saw an unhighlighted toolbar and concluded the default wasn't being
applied even though the matrix was filtered.

- DEFAULT_STATUS_FILTER: ["running"] -> ["Running"]
- Update test expectation to match
@github-actions github-actions Bot added fix and removed fix labels Apr 28, 2026
@TerrifiedBug TerrifiedBug merged commit ae0706c into main Apr 28, 2026
15 checks passed
@TerrifiedBug TerrifiedBug deleted the fix/matrix-default-filter-casing branch April 28, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant