Skip to content

[fix]: code evaluator code editor issues#4715

Open
ashrafchowdury wants to merge 2 commits into
mainfrom
fix/evaluator-code-eval-code-block
Open

[fix]: code evaluator code editor issues#4715
ashrafchowdury wants to merge 2 commits into
mainfrom
fix/evaluator-code-eval-code-block

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

closes #4641

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 17, 2026 3:15pm

Request Review

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working Frontend labels Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved preservation of trailing content when pasting code to maintain proper formatting.
  • Improvements

    • Adjusted sticky header positioning based on view mode (embedded vs. standard).
    • Disabled unnecessary height animations in code-only editors for a cleaner experience.

Walkthrough

Adds a stickyHeaderTop prop to PlaygroundConfigSection (defaulting to 48) so embedded vs. non-embedded callers can control sticky header offsets. Separately, the code editor paste utility is fixed to rebuild trailing lines from captured text content rather than cloned Lexical nodes, and height transition animations are disabled for codeOnly editor containers.

Changes

Configurable sticky header top offset

Layer / File(s) Summary
stickyHeaderTop prop and application
web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx
Adds optional stickyHeaderTop?: number prop (default 48) to PlaygroundConfigSectionProps and replaces hard-coded top-[48px] Tailwind class with style={{ top: stickyHeaderTop }} on both sticky header sites.
Pass stickyHeaderTop from variant config
web/oss/src/components/Playground/Components/PlaygroundVariantConfig/index.tsx
Passes stickyHeaderTop={0} when embedded is true, and stickyHeaderTop={48} otherwise, into PlaygroundConfigSection.

Code editor paste fix and animation suppression

Layer / File(s) Summary
Rebuild trailing lines from text in paste handler
web/packages/agenta-ui/src/Editor/plugins/code/utils/pasteUtils.ts
Captures trailing line text content before removing nodes, then reconstructs each trailing line after pasted block insertion via $createNodeForLineWithTabs(text, language) instead of inserting $copyNode-cloned nodes.
Suppress height transition for codeOnly editors
web/packages/agenta-ui/src/SharedEditor/SharedEditorImpl.tsx
Omits interpolateSize, transitionProperty, transitionDuration, and transitionTimingFunction from the container style when editorProps?.codeOnly is true.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SharedEditorImpl
  participant pasteUtils
  participant LexicalEditor

  User->>SharedEditorImpl: paste into code editor
  SharedEditorImpl->>pasteUtils: handleCodePaste(event, editor)
  pasteUtils->>LexicalEditor: read trailingLine.getTextContent() → trailingLineTexts[]
  pasteUtils->>LexicalEditor: remove trailing nodes, insert pasted lines
  loop each captured trailing text
    pasteUtils->>LexicalEditor: $createNodeForLineWithTabs(text, language)
    LexicalEditor-->>pasteUtils: fresh line node
    pasteUtils->>LexicalEditor: insertAfter(fresh line node)
  end
  LexicalEditor-->>SharedEditorImpl: updated editor state (no height transition for codeOnly)
  SharedEditorImpl-->>User: rendered code with trailing content preserved
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive The sticky header positioning changes enhance editor UX and appear related to the paste fix context; however, they lack direct documentation in the linked issue. Clarify whether sticky header improvements are part of the scope for #4641 or represent separate enhancements beyond the paste deletion fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[fix]: code evaluator code editor issues' is directly related to the main change—addressing the paste deletion bug in the code evaluator's editor.
Description check ✅ Passed The description 'closes #4641' is related to the changeset, referencing the linked issue about the paste deletion problem.
Linked Issues check ✅ Passed The changes fix the paste deletion bug [#4641] by capturing trailing code content before removal and rebuilding lines from captured text, directly addressing the issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/evaluator-code-eval-code-block

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3853b3ae-658a-4555-b15e-a63569068124

📥 Commits

Reviewing files that changed from the base of the PR and between 58a5cca and 47f113d.

📒 Files selected for processing (4)
  • web/oss/src/components/Playground/Components/PlaygroundVariantConfig/index.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/components/PlaygroundConfigSection.tsx
  • web/packages/agenta-ui/src/Editor/plugins/code/utils/pasteUtils.ts
  • web/packages/agenta-ui/src/SharedEditor/SharedEditorImpl.tsx

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-production-0de2.up.railway.app/w
Image tag pr-4715-d38054d
Status Failed
Railway logs Open logs
Logs View workflow run
Updated at 2026-06-17T15:27:22.875Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Frontend size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasting in code evaluator deletes existing content

2 participants