improvement(rich-md-editor): streaming, performance, minor bugfixes#5148
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Streaming & reconciliation: Text editor state gains Rich markdown: Large streams throttle full re-parses (~40k+ chars). Bubble menu is Linear-style (fixed anchor, reveal on drag-release, portal to body); new link hover card and shared toolbar buttons. Mod+K is yielded from global commands via Sidebar: Reviewed by Cursor Bugbot for commit 871068a. Configure here. |
|
@greptile |
Greptile SummaryThis PR adds smooth streaming support for the rich-markdown editor, performance improvements for large files, and several UX fixes including a new link-hover card, a drag-select–reveal bubble menu, and a sidebar collapse refactor that eliminates FOUC on SSR.
Confidence Score: 4/5Safe to merge with two targeted fixes: the reconciling-path race in text-editor-state.ts, and the draftHref reset in the new link-hover card. The streaming state machine correctly fixes the streaming-active path with the hasBaseline guard, but the parallel reconciling path still uses the bare fetchedContent !== savedContent check — leaving the same stale-content race for a fast stream that ends before the fetch. The new LinkHoverCard does not reset draftHref when activeLink changes while editing, which can silently apply the wrong URL to the wrong link. The remaining changes are well-reasoned and correct. apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor-state.ts (reconciling path, line 151) and apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/link-hover-card.tsx (onOver handler). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[streamingContent arrives] --> B{isNextStreaming?}
B -- yes --> C{hasBaseline?}
C -- no, fetch arrived --> D[adoptBaseline]
C -- yes --> E{hasFetchedAdvanced?}
E -- yes --> F[finalize: phase=ready]
E -- no --> G[phase=streaming]
D --> G
B -- no --> H{phase=streaming/reconciling?}
H -- yes --> I{fetchedContent defined?}
I -- yes --> J{hasFetchedAdvanced? missing hasBaseline guard}
J -- true --> K[finalize]
J -- false --> L[phase=reconciling]
I -- no --> L
H -- no --> M[ready/uninitialized]
style J fill:#ffcccc,stroke:#cc0000
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[streamingContent arrives] --> B{isNextStreaming?}
B -- yes --> C{hasBaseline?}
C -- no, fetch arrived --> D[adoptBaseline]
C -- yes --> E{hasFetchedAdvanced?}
E -- yes --> F[finalize: phase=ready]
E -- no --> G[phase=streaming]
D --> G
B -- no --> H{phase=streaming/reconciling?}
H -- yes --> I{fetchedContent defined?}
I -- yes --> J{hasFetchedAdvanced? missing hasBaseline guard}
J -- true --> K[finalize]
J -- false --> L[phase=reconciling]
I -- no --> L
H -- no --> M[ready/uninitialized]
style J fill:#ffcccc,stroke:#cc0000
|
… on-screen for tall selections, restyle task-list checkbox
…ut while scrolling
A collapsed rail painted at the expanded width then animated to 51px on refresh: structure came from the cookie (server) while width came from independent cookie reads (blocking script + store), so any disagreement left the collapsed structure at the persisted expanded width until the store corrected it. Unify collapse into one derivation in WorkspaceChrome and drive the collapsed width from a server-rendered data-collapsed attribute via CSS (.sidebar-shell-outer[data-collapsed]) — the same cookie source as the structure, so width can never diverge from it. This is shadcn's documented pattern (data-attribute selectors over JS ternaries for collapsed dimensions). Also removes the redundant migratedCollapsed reconciliation (the store already seeds from the migrated cookie and hasHydrated flips in the same pre-paint effect) and the now-unused per-Sidebar derivation; Sidebar takes isCollapsed as a prop.
…obal command registry
… extract the shared toolbar button
…sformed ancestor can't offset them; align fade with the tooltip
|
@cursor review |
|
@greptile |
There was a problem hiding this comment.
✅ 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 0834afe. Configure here.
The error UI renders Sidebar outside WorkspaceChrome, so it has no derived collapse state; feed it the same source of truth via readCollapsedCookie() now that isCollapsed is a required prop.
|
@greptile |
…hildren pre-escapes backslashes)
|
@cursor review |
1 similar comment
|
@cursor review |
|
@greptile |
There was a problem hiding this comment.
✅ 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 b064503. Configure here.
…tarts, even if the body is unchanged
|
@cursor review |
There was a problem hiding this comment.
✅ 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 871068a. Configure here.
Summary
Smooth streaming support, perf improvements, minor bugfixes
Type of Change
Testing
Tested manually
Checklist