Skip to content

fix(tables): key filter UI by stable column id; show column name in delete confirm#4930

Merged
TheodoreSpeaks merged 2 commits into
stagingfrom
fix/table-filter
Jun 9, 2026
Merged

fix(tables): key filter UI by stable column id; show column name in delete confirm#4930
TheodoreSpeaks merged 2 commits into
stagingfrom
fix/table-filter

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Table filters broke after the stable-column-ids change (feat(tables): stable column ids for metadata-only rename #4898): the filter UI still built filter objects keyed by column name, but rows/API now key on the stable column id — filters matched nothing
  • Make TableFilter id-native: dropdown option values use getColumnId, names stay as display labels, selected column renders the label via lookup
  • Delete-column confirm modal showed the raw col_… id — now resolves it back to the column's display name

Type of Change

  • Bug fix

Testing

Tested manually. tsc --noEmit, bun run lint:check, and bun run check:api-validation:strict all pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 9, 2026 10:05pm

Request Review

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

@cursor

cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Small UI-only alignment with existing id-keyed query/filter data; no auth, API, or persistence changes beyond correct field keys in filter state.

Overview
Fixes table filtering and delete confirmation after stable column ids: filter rules now store getColumnId keys (with column names as labels), and the single-column delete modal shows the resolved display name instead of a raw col_… id.

TableFilter now takes ColumnDefinition[], builds dropdown values from stable ids, and shows the selected column label via lookup. New rules default to the first column’s id, not its name.

table.tsx maps deletingColumns[0] through columns + getColumnId for the confirm copy only; delete behavior is unchanged.

Reviewed by Cursor Bugbot for commit f9aee7e. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two related regressions following the stable-column-ids change in #4898: filter rules now use getColumnId for column option values (so filters match on the stable id rather than the mutable display name), and the delete-column confirmation modal resolves the stored column id back to a human-readable name.

  • table-filter.tsx: TableFilterProps.columns is tightened to ColumnDefinition[]; columnOptions maps each column to { value: getColumnId(col), label: col.name }; the selected-column display label resolves via the options lookup, with graceful fallback; createRule seeds the default column field with the stable id.
  • table.tsx: The single-column delete confirmation now resolves deletingColumns[0] (a col_… id) back to the column's display name via columns.find(…)?.name, with a raw-id fallback for any column not found in the current schema.

Confidence Score: 5/5

Safe to merge; the changes are narrow, targeted, and correctly restore filter matching and the delete-column modal UX after the stable-id migration.

Both changed code paths have the correct logic: filter rules now carry stable column ids so queries match row data, and the delete modal performs a proper id→name lookup with a sensible fallback. Backward compatibility with legacy name-keyed columns is preserved because getColumnId falls back to the column name when no id is present.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-filter/table-filter.tsx Corrects filter keying from column name to stable column id; id→label resolution and fallback logic are correct; backward-compatible with legacy columns that lack an id (getColumnId falls back to name).
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Delete-column confirmation modal now resolves the stable column id to a display name; fallback to raw id is correct for any column removed from the current schema.
bun.lock Lockfile changes; no dependency changes of concern.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[TableFilter receives ColumnDefinition array] --> B[columnOptions: value=getColumnId, label=col.name]
    B --> C[FilterRuleRow dropdown keyed by stable id]
    C --> D{User selects column}
    D --> E[rule.column = stable col id]
    E --> F[Display: find col where value matches rule.column]
    F --> G[filterRulesToFilter builds Filter keyed by col id]
    G --> H[API query matches row data keys correctly]

    I[Delete column triggered] --> J[deletingColumns holds stable col id]
    J --> K[Confirm modal: find column where getColumnId matches]
    K --> L[Shows human-readable column name]
Loading

Reviews (4): Last reviewed commit: "fix(tables): import getColumnId from col..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two regressions introduced by the stable-column-ids change (#4898): filter rules were still keying on column display names instead of stable ids (so no rows ever matched), and the delete-column confirm modal was surfacing raw col_… ids to users.

  • TableFilter now uses getColumnId when building columnOptions values and when initializing a new FilterRule, ensuring rule.column always carries the stable id that the query layer expects; the dropdown display resolves the id back to a label via a map lookup with a safe fallback.
  • The delete-column confirm modal resolves deletingColumns[0] (a stable column id) back to the column's display name through columns.find(...getColumnId...)?.name, with a fallback to the raw id for robustness.

Confidence Score: 4/5

Safe to merge. Both changed files make targeted, self-contained fixes that restore expected behaviour without touching any shared utilities or data layer.

The filter key fix and the delete-modal name resolution are both correct. The one remaining rough edge — const names = deletingColumns aliasing stable column ids under a misleading variable name — is a pre-existing naming holdover and does not affect runtime behaviour.

No files require special attention beyond the minor naming note in table.tsx.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-filter/table-filter.tsx Props type widened to ColumnDefinition[]; columnOptions now keyed by stable column id via getColumnId; FilterRuleRow display resolves id→label with correct fallback; createRule initializes column with id. Logic is correct.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx Delete-column confirm modal now resolves raw column id to display name via columns.find+getColumnId with correct fallback to the raw id if not found. Change is minimal and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["ColumnDefinition[]\n(id?, name, type)"] --> B["getColumnId(col)\n→ col.id ?? col.name"]
    B --> C["columnOptions\n{ value: colId, label: colName }"]
    C --> D["FilterRuleRow dropdown\nonSelect → rule.column = colId"]
    D --> E["FilterRule\n{ column: colId, operator, value }"]
    E --> F["filterRulesToFilter(rules)\n→ Filter { colId: condition }"]
    F --> G["Query layer\nmatches row.data[colId] ✓"]

    H["Existing filter prop\n(Filter keyed by colId)"] --> I["filterToRules(filter)\n→ FilterRule[] { column: colId }"]
    I --> D

    J["Display in dropdown trigger"] --> K{"columns.find(col =>\ncol.value === rule.column)"}
    K -->|found| L["show col.label (display name)"]
    K -->|not found| M["show rule.column as fallback"]
Loading

Comments Outside Diff (1)

  1. apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx, line 513-517 (link)

    P2 Misleading variable name for stable column ids

    deletingColumns now holds stable column ids (e.g. col_abc123) rather than display names since PR feat(tables): stable column ids for metadata-only rename #4898, but const names = deletingColumns re-aliases them as names before forwarding to confirmDeleteColumnsSinkRef.current. This isn't a functional bug — the sink correctly treats the values as column keys for deletion — but it creates a naming mismatch that is now more visible given that the modal itself had to add an id→name resolution step to show human-readable text. Renaming the local to something like ids or columnIds would keep the intent legible alongside the new modal lookup.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "fix(tables): key filter UI by stable col..." | Re-trigger Greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

1 similar comment
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

@TheodoreSpeaks TheodoreSpeaks merged commit c7689c0 into staging Jun 9, 2026
14 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the fix/table-filter branch June 9, 2026 22:20
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