Skip to content

fix(table): fix table boolean, add dynamic row number col size, search & replace improvements - #4515

Merged
waleedlatif1 merged 22 commits into
stagingfrom
fix/tabl
May 8, 2026
Merged

fix(table): fix table boolean, add dynamic row number col size, search & replace improvements#4515
waleedlatif1 merged 22 commits into
stagingfrom
fix/tabl

Conversation

@waleedlatif1

@waleedlatif1waleedlatif1 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • fix table boolean click
  • add dynamic row number col size
  • Search and Replace code improvements + better edge case handling for different subblock types
  • fix resource sidebar column position
  • fix double toast on invalid save for col type change in the tables module

Type of Change

  • Bug fix

Testing

Manually

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

vercelBot commented May 8, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedMay 8, 2026 5:18pm

Request Review

@cursor

cursorBot commented May 8, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches table grid rendering/selection behavior and significantly extends workflow search/replace and function-code variable interpolation, which could introduce subtle UI/behavior regressions despite being well-tested.

Overview
Fixes several table UX issues: boolean cells now expose a stable click target, the sticky row-number gutter width is computed from maxRows digit count (instead of a coarse threshold), and selection overlays/tints align correctly at the left edge. Column/workflow sidebars also avoid double error toasts on validation failures and make minor header spacing adjustments.

Improves workflow editor search/replace: introduces a shared highlight style and supports nested field highlighting for input-format, response-format, and eval-input (including unmasking password fields when highlighted). Search/replace resource handling is expanded to hydrate and offer replacements for tables, workspace files, and MCP servers/tools (with server-scoped MCP tool options), refactors resource utilities under search-replace/resources, and adds broader indexer coverage/edge-case tests (visibility rules, structured subblocks, tool params, selector contexts).

Hardens execution variable interpolation for function blocks by detecting whether a <Block.ref> occurs inside JS/Python string literals, template literals, or comments and emitting safer replacements (e.g., JSON-stringifying when embedded in quotes). Also adds optimistic-collab safeguards by skipping batch subblock/subflow updates when expected values no longer match.

Reviewed by Cursor Bugbot for commit e716220. Configure here.

@greptile-apps

greptile-appsBot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR delivers a set of targeted bug fixes and improvements across the table module and the workflow search-replace system. The most substantial work is in the search-replace indexer: it now handles tool-input sub-blocks, JSON-structured sub-block types (condition-input, router-input, etc.), and visibility/feature-flag filters when indexing matches. The variable resolver gains a proper string-context scanner that correctly wraps block references in string-break expressions when inserted inside JavaScript or Python literals.

  • Table grid: boolean cell click is fixed with a data-boolean-cell-toggle attribute; the row-number column width is now computed dynamically from Math.floor(Math.log10(maxRows)) + 1 digits rather than a hard-coded two-bucket lookup; selection overlay left-edge bleeding is fixed per column index.
  • Search-replace: new files (json-value-fields.ts, resources/registry.ts, resources/references.ts, resources/resolvers.ts, resources/validation.ts) modularize resource handling; getWorkflowSearchDependentClears is upgraded to BFS so transitive dependency clears propagate correctly.
  • Resolver: getCodeStringQuoteContext is a new state-machine scanner that tracks single/double/triple-quote Python strings, JS template literals, template expressions, line and block comments, correctly enabling json.dumps/JSON.stringify wrapping only when the reference appears inside a string literal.

Confidence Score: 5/5

This PR is safe to merge. All changes are well-scoped bug fixes and refactors with good test coverage.

The resolver scanner is the highest-risk new logic; it is exercised by a comprehensive suite of unit tests covering JS strings, template literals, template expressions, Python single/double/triple-quoted strings, escaped characters, and comment handling. The search-replace refactoring consolidates previously scattered files into a clean resource registry and is backed by extensive indexer and replacements tests. The table-grid changes are mechanical and easy to verify visually.

No files require special attention; the indexer and resolver changes are the most complex but are well covered by tests.

Important Files Changed

FilenameOverview
apps/sim/executor/variables/resolver.tsAdds getCodeStringQuoteContext state-machine scanner for JS/Python/template literal string contexts; wraps block references in json.dumps/JSON.stringify string-break expressions when inside a string literal. Well-tested.
apps/sim/lib/workflows/search-replace/indexer.tsMajor expansion: handles tool-input sub-blocks, JSON-structured sub-block types, visibility/mode/feature-flag filtering, and reactive credential conditions. Delegates to new helper modules.
apps/sim/lib/workflows/search-replace/json-value-fields.tsNew file providing leaf-extraction and in-place replacement for JSON-structured sub-block values (condition-input, router-input, table, input-mapping, etc.).
apps/sim/lib/workflows/search-replace/resources/registry.tsNew central codec registry for structured resource kinds (selector, knowledge-base, table, file, mcp-server, mcp-tool, oauth-credential). Consolidates parse/contains/replace logic per kind.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsxReplaces 4-bucket row-number column sizing with checkboxColLayout dynamic formula; fixes selection overlay left-edge bleed on first column; fixes boolean cell click via data-boolean-cell-toggle.
apps/sim/lib/workflows/search-replace/dependencies.tsUpgrades getWorkflowSearchDependentClears from single-level lookup to BFS so transitive dependency clears propagate correctly; uses a visited set to prevent cycles.
apps/sim/hooks/queries/workflow-search-replace.tsAdds useWorkflowSearchTableReplacementOptions, useWorkflowSearchFileReplacementOptions, useWorkflowSearchMcpServerReplacementOptions, and useWorkflowSearchMcpToolReplacementOptions hooks; keys all queries; updates knowledge options to be match-driven.
apps/sim/lib/workflows/subblocks/visibility.tsExports parseDependsOn, normalizeDependencyValue, and trigger-mode helpers (isSubBlockVisibleForTriggerMode, shouldUseSubBlockForTriggerModeCanonicalIndex) for use by the search indexer.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[indexWorkflowSearchMatches] --> B{subBlock type?}
B -->|tool-input| C[addToolInputMatches]
B -->|display-only| D[skip]
B -->|other| E{mode?}
C --> F[parseStoredToolInputValue]
F --> G[getToolInputParamConfigs]
G --> H[buildToolInputSearchConfig per param]
H --> I[addTextMatches / addInlineReferenceMatches]
E -->|text mode| J[getTextLeaves]
J --> K{isSearchableJsonValueSubBlock?}
K -->|yes| L[getSearchableJsonStringLeaves]
K -->|no| M[getSearchableStringLeaves]
L --> N[addTextMatches]
M --> N
E -->|resource mode| O[getSearchableStringLeaves reference]
O --> P[parseInlineReferences]
O --> Q[parseStructuredResourceReferences]
P --> R[environment / workflow-reference matches]
Q --> S[structured resource matches]
subgraph Resolver
T[formatCodeContextVariableReference] --> U[getCodeStringQuoteContext]
U --> V{context?}
V -->|template| W[wrap in dollar-brace]
V -->|single/double/triple| X[break string + dumps/stringify]
V -->|null code context| Y[plain globalThis/globals ref]
end
Loading

Reviews (7): Last reviewed commit: "escaped behaviour" | Re-trigger Greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3e0ef3a. Configure here.

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review @greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator

@greptile

Comment threadapps/sim/hooks/queries/tables.ts
Comment threadapps/sim/hooks/queries/tables.ts
@icecrasher321

Copy link
Copy Markdown
Collaborator

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator

bugbot run

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 427a530. Configure here.

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

Comment threadapps/sim/executor/variables/resolver.ts

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e716220. Configure here.

@icecrasher321

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1
waleedlatif1 merged commit 57f00e2 into stagingMay 8, 2026
13 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/tabl branch May 8, 2026 17:39
@icecrasher321icecrasher321 changed the title fix(table): fix table boolean, add dynamic row number col size, search & replace imporvementsfix(table): fix table boolean, add dynamic row number col size, search & replace improvementsMay 8, 2026
Sign up for freeto 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.

2 participants

@waleedlatif1@icecrasher321