Skip to content

fix(files): fix large file editor performance and selection toolbar placement - #7171

Merged
waleedlatif1 merged 2 commits into
stagingfrom
codex/paste-performance-safe
Aug 27, 2026
Merged

fix(files): fix large file editor performance and selection toolbar placement#7171
waleedlatif1 merged 2 commits into
stagingfrom
codex/paste-performance-safe

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Avoid rereading the complete Monaco model and reapplying static editor options after local edits.
  • Bound XLSX conversion to the existing 1,000-row preview window and a 200-column safety window, with explicit row/column truncation messaging.
  • Anchor whole-document Markdown selections to the leading position so the formatting toolbar flips below the header instead of clipping.
  • Add focused regression coverage for editor synchronization, worksheet bounds, and whole-document selection geometry.

Testing

  • bun run lint
  • bun run lint:check
  • bun run type-check
  • bun run check:api-validation
  • bun run check:audits
  • bun run apps/sim/scripts/check-block-registry.ts origin/staging
  • bunx vitest run (51 focused file-editor tests)

Compatibility

No migrations, API changes, or environment changes. Text and Markdown editor limits are unchanged. XLSX files remain fully downloadable; only the in-app preview uses the existing 1,000-row boundary plus a 200-column safety boundary to prevent rendering more than 200,000 cells at once.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 27, 2026 6:58pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This follow-up improves large-file editor performance and selection-toolbar placement while bounding XLSX conversion to the displayed preview window.

  • Avoids rereading Monaco content after ordinary local edits and memoizes static editor options.
  • Limits XLSX conversion to 1,000 rows and 200 columns with corresponding truncation messaging.
  • Anchors whole-document Markdown selections at the document’s leading position.
  • Adds focused synchronization, worksheet-boundary, and selection-geometry tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor.tsx Adds cached Monaco value tracking and stable editor options to reduce work during local edits while retaining external-content reconciliation.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/xlsx-preview-data.ts Extracts bounded XLSX preview conversion with explicit row and column truncation metadata.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/xlsx-preview.tsx Uses bounded worksheet data and reports whether rows, columns, or both were truncated.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/use-bubble-menu-floating.ts Collapses whole-document selection geometry to a leading-position anchor while preserving ordinary selection ranges.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor-sync.test.tsx Covers local-edit fast-path behavior and external-update reconciliation.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/xlsx-preview-data.test.ts Covers row limits, exact-boundary behavior, and extremely wide worksheet ranges.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/use-bubble-menu-floating.test.ts Covers whole-document anchor collapse and preservation of ordinary text-selection geometry.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[File viewer] --> B{File type}
  B -->|Text| C[Monaco editor]
  C --> D[Cached editor value]
  D --> E[External-content reconciliation]
  B -->|XLSX| F[Decode worksheet range]
  F --> G[Bound to 1000 rows and 200 columns]
  G --> H[Data table preview]
  B -->|Markdown| I[ProseMirror selection]
  I --> J{Whole-document selection?}
  J -->|Yes| K[Collapse anchor to leading position]
  J -->|No| L[Preserve selection range]
  K --> M[Floating formatting toolbar]
  L --> M
Loading

Reviews (2): Last reviewed commit: "fix(files): bound wide spreadsheet previ..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 changed the title Fix large file editor performance and selection toolbar placement fix(files): fix large file editor performance and selection toolbar placement Aug 27, 2026

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
waleedlatif1 merged commit 5682c6c into staging Aug 27, 2026
29 of 30 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/paste-performance-safe branch August 27, 2026 19:50
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