Skip to content

fix(table-block): resolve canonical tableId in filter/sort builders#4294

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/tables-col-picker
Apr 24, 2026
Merged

fix(table-block): resolve canonical tableId in filter/sort builders#4294
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/tables-col-picker

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Filter/sort builders in the Table block were always showing "no options available" in the column picker
  • They read the selected tableId from subBlock id 'tableId', but the Table block stores the value under 'tableSelector' (basic) or 'manualTableId' (advanced) via canonicalParamId — the lookup always returned null, so useTable stayed disabled and columns never loaded
  • Added useCanonicalSubBlockValue which resolves a value by canonicalParamId through the canonical index (same pattern dropdowns use for dependsOn), and swapped it into FilterBuilder and SortBuilder

Type of Change

  • Bug fix

Testing

Tested manually — columns now populate in the Query Rows filter/sort builders and the Update/Delete by filter builder when a table is selected in either basic or advanced mode.

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)

The visual filter/sort builders read the selected tableId from subBlock id
'tableId', but the Table block stores it under 'tableSelector' (basic) or
'manualTableId' (advanced) via canonicalParamId. The lookup always returned
null, so useTable was disabled and the column picker always showed
"no options available".

Adds useCanonicalSubBlockValue that resolves by canonicalParamId through
the canonical index, mirroring the pattern used by dropdown dependsOn.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 24, 2026 11:15pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 24, 2026

PR Summary

Low Risk
Low risk, localized UI-state read change: filter/sort builders now resolve tableId via canonicalParamId mapping, which could affect which sub-block value wins in edge cases but doesn’t touch auth/data writes.

Overview
Fixes Table block filter/sort builders failing to load column options when the selected table is stored under canonical basic/advanced inputs.

Adds useCanonicalSubBlockValue to read a sub-block value via canonicalParamId resolution (using the existing canonical index + resolveDependencyValue), and switches FilterBuilder/SortBuilder to use it when deriving tableId for useTableColumns.

Reviewed by Cursor Bugbot for commit caa42e4. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

This bug fix resolves a longstanding issue where the column picker in the Table block's filter and sort builders always showed "no options available" because useSubBlockValue was looking up 'tableId' as a raw sub-block ID — which doesn't exist — while the actual values live under 'tableSelector' (basic) or 'manualTableId' (advanced) via canonicalParamId. The new useCanonicalSubBlockValue hook reuses buildCanonicalIndex / resolveDependencyValue from the existing visibility module to resolve whichever canonical member currently holds the value, exactly as the dropdown dependsOn logic does.

Confidence Score: 5/5

Safe to merge — targeted bug fix with no breaking changes and no P0/P1 issues found.

The implementation follows established patterns (useStoreWithEqualityFn + isEqual, buildCanonicalIndex/resolveDependencyValue), handles null gracefully (useTableColumns already accepts null via ?? undefined), and the change is minimal and focused. All remaining observations are P2 or lower.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-canonical-sub-block-value.ts New hook that resolves sub-block values through the canonical index, fixing the broken table ID lookup for filter/sort builders; correctly uses useStoreWithEqualityFn with isEqual and memoized selectors following established patterns.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/filter-builder/filter-builder.tsx Swaps useSubBlockValue for useCanonicalSubBlockValue for tableIdValue; the API change (no setter destructuring) is intentional and correct since the value is read-only.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/sort-builder/sort-builder.tsx Same tableIdValue fix as filter-builder.tsx; no other changes, straightforward and correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["FilterBuilder / SortBuilder\nuseCanonicalSubBlockValue(blockId, 'tableId')"] --> B["buildCanonicalIndex(blockConfig.subBlocks)"]
    B --> C{canonicalId found\nfor 'tableId'?}
    C -- Yes --> D["getCanonicalValues(group, blockValues)"]
    D --> E["resolveCanonicalMode\n(basic or advanced?)"]
    E -- basic --> F["values['tableSelector']"]
    E -- advanced --> G["values['manualTableId']"]
    F --> H["tableIdValue → useTableColumns"]
    G --> H
    C -- No --> I["values['tableId'] (undefined fallback)"]
    I --> J["tableIdValue = null\n(columns stay empty)"]
    H --> K["Column options populated ✓"]
Loading

Reviews (1): Last reviewed commit: "fix(table-block): resolve canonical tabl..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit e6fefc8 into staging Apr 24, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/tables-col-picker branch April 24, 2026 23:24
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