improvement(patch): append, patch snapshot based streaming#5161
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview A new The editor keeps the flag in a ref so in-flight ticks see the latest edit kind if the operation changes mid-turn. Reviewed by Cursor Bugbot for commit 267d7d5. Configure here. |
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to the markdown editor's streaming tick and does not touch any data-persistence, authentication, or API paths. The logic is self-contained: a single boolean flag read via a ref inside a RAF tick, guarded only on the RAF path (never affecting settle or persistence). The ref pattern is correct for this async context. The settle path is unchanged and acts as a safety net regardless of operation type, ensuring the final server-persisted content is always applied. No edge cases found that would lead to incorrect document state. No files require special attention. rich-markdown-editor.tsx carries the most logic, but the change is well-isolated to the existing streaming tick. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant RC as ResourceContent
participant FV as FileViewer
participant LME as LoadedRichMarkdownEditor
participant RAF as RAF tick
RC->>RC: "operation == append|patch → streamIsIncremental=true"
RC->>FV: streamIsIncremental
FV->>LME: streamIsIncremental
LME->>LME: "streamIsIncrementalRef.current = streamIsIncremental"
alt "append / patch (incremental)"
LME->>RAF: "arm tick with new snapshot"
RAF->>RAF: "streamIsIncrementalRef=true, skip hold guard"
RAF->>LME: "setContent(snapshot) live apply"
else "create / update (rebuild)"
LME->>RAF: "arm tick with new chunk"
RAF->>RAF: "extendsShown=false, streamIsIncremental=false, hold"
RAF-->>LME: "held until settle"
end
LME->>LME: "settle: cancel RAF, apply final body if differs"
%%{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"}}}%%
sequenceDiagram
participant RC as ResourceContent
participant FV as FileViewer
participant LME as LoadedRichMarkdownEditor
participant RAF as RAF tick
RC->>RC: "operation == append|patch → streamIsIncremental=true"
RC->>FV: streamIsIncremental
FV->>LME: streamIsIncremental
LME->>LME: "streamIsIncrementalRef.current = streamIsIncremental"
alt "append / patch (incremental)"
LME->>RAF: "arm tick with new snapshot"
RAF->>RAF: "streamIsIncrementalRef=true, skip hold guard"
RAF->>LME: "setContent(snapshot) live apply"
else "create / update (rebuild)"
LME->>RAF: "arm tick with new chunk"
RAF->>RAF: "extendsShown=false, streamIsIncremental=false, hold"
RAF-->>LME: "held until settle"
end
LME->>LME: "settle: cancel RAF, apply final body if differs"
Reviews (1): Last reviewed commit: "improvement(path): append, patch snapsho..." | Re-trigger Greptile |
Summary
Classify the stream by operation instead of by prefix:
Type of Change
Testing
Tested manually
Checklist