Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

@waleedlatif1 waleedlatif1 commented Feb 11, 2026

Summary

  • Use navigator.sendBeacon in beforeunload to persist in-progress messages (including thinking blocks) during page refresh/close
  • Flush batched streaming updates before beacon persistence so contentBlocks are up to date
  • abortMessage uses beacon instead of fire-and-forget fetch when page is unloading
  • Fix double-digit ordered list clipping in thinking block (pl-6pl-8)

Type of Change

  • Bug fix

Testing

Tested 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
Copy link

vercel bot commented Feb 11, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Feb 11, 2026 6:46am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

This PR successfully migrates all markdown renderers from react-markdown to streamdown, removing 100+ lines of complex character-by-character animation logic.

Key improvements:

  • Replaced react-markdown with streamdown across 5 markdown renderers (copilot, chat, note-block, templates, changelog)
  • Removed character animation logic from SmoothStreamingText and SmoothThinkingText - streamdown's remend library handles incomplete markdown natively
  • Added custom softBreaks preprocessor in note-block to replace remark-breaks functionality
  • Fixed double-digit ordered list clipping by changing pl-6 to pl-8 in thinking block
  • Removed dependencies: react-markdown and remark-breaks

Minor style issue:

  • timeline-list.tsx uses any types for component props instead of proper TypeScript types

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The migration is well-executed with significant code reduction. Streamdown includes remark-gfm as a dependency, ensuring GFM support is maintained. The custom softBreaks preprocessor correctly replicates remark-breaks behavior. Only minor style issue with any types that doesn't affect functionality.
  • No files require special attention - all changes are straightforward library replacements

Important Files Changed

Filename Overview
apps/sim/package.json Removed react-markdown and remark-breaks, added streamdown dependency
apps/sim/app/changelog/components/timeline-list.tsx Migrated from ReactMarkdown to Streamdown, simplified component props using any type
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx Migrated to Streamdown and added custom softBreaks preprocessor to replace remark-breaks
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/smooth-streaming/smooth-streaming.tsx Removed 60+ lines of character-by-character animation logic, relies on Streamdown's native incomplete markdown handling
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block/thinking-block.tsx Removed character animation logic and fixed ordered list padding (pl-6 → pl-8)

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant Old as react-markdown
    participant New as Streamdown
    participant Remend as remend (incomplete MD)
    
    Note over App,Remend: Before Migration
    App->>Old: Render markdown content
    Old->>Old: Apply remark-breaks plugin
    Old->>Old: Apply remarkGfm plugin
    Old->>App: Return rendered output
    
    Note over App,Remend: After Migration
    App->>New: Render markdown content
    New->>New: Built-in GFM support
    New->>Remend: Handle incomplete markdown
    Remend->>Remend: Gracefully render partial syntax
    New->>App: Return streaming-aware output
    
    Note over App,New: Streaming Text
    loop Character streaming removed
        App->>New: Pass full content directly
        New->>Remend: Process incomplete markdown
        Remend->>App: Render without animation buffer
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

<Streamdown
components={{
h2: ({ children, ...props }) =>
h2: ({ children }: any) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Using any type violates TypeScript conventions - consider using proper types from Streamdown's component prop types

Suggested change
h2: ({ children }: any) =>
h2: ({ children }: { children?: React.ReactNode }) =>

Context Used: Context from dashboard - TypeScript conventions and type safety (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Use navigator.sendBeacon in beforeunload handler to reliably persist
  in-progress messages (including thinking blocks) during page teardown
- Flush batched streaming updates before beacon persistence
- Fall back to sendBeacon in abortMessage when page is unloading
- Fix double-digit ordered list clipping in thinking block (pl-6 → pl-8)
@waleedlatif1 waleedlatif1 changed the title feat(markdown): migrate from react-markdown to streamdown fix(copilot): persist thinking blocks on page refresh Feb 11, 2026
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