fix:serialize object variable values before copying to clipboard#8362
fix:serialize object variable values before copying to clipboard#8362adwait-bruno wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesVariable display and clipboard handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-app/src/utils/codemirror/brunoVarInfo.js`:
- Around line 156-162: The clipboard normalization in the value-copy path now
handles objects via pretty JSON and nullish values via empty-string coercion,
but the current specs only cover string copying. Add/extend tests around the
brunoVarInfo value-copy behavior to verify the function that builds valueStr
produces pretty-printed JSON for object inputs and an empty string for
null/undefined inputs, in addition to the existing string case, so the new
normalization behavior is protected from regressions.
- Around line 156-162: `JSON.stringify` in `brunoVarInfo` can throw for circular
or unsupported object values before the clipboard write runs. Update the copy
flow around the `valueStr` निर्माण to safely handle object formatting with a
guarded stringify and a fallback string path when serialization fails, so
`navigator.clipboard.writeText(...)` still executes. Add or adjust cases in
`brunoVarInfo.spec.js` to cover plain objects and circular/object-serialization
failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 99fff671-2e49-429f-a86b-804e1ec34b3d
📒 Files selected for processing (1)
packages/bruno-app/src/utils/codemirror/brunoVarInfo.js
b43f920 to
11d296a
Compare
Description
Copying a variable with an object value from the hover popup writes [object Object] to the clipboard instead of the actual value.navigator.clipboard.writeText() expects a string. When the resolved variable value is an object passing it directly causes the browser to coerce it to [object Object]. The fix serializes the value with JSON.stringify before writing to the clipboard.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
nullis copied as the textnull.