refactor: remove HTML validation functions and simplify HtmlPreview component logic#6730
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe PR removes HTML-validity checks and routes all string response data into the HTML rendering path (webview with a dynamic base tag). Two helper validators ( Changes
Sequence Diagram(s)(Skipped — changes are localized to component rendering logic and helper removal; no multi-component sequential flow requiring visualization.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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: 0
🧹 Nitpick comments (1)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultPreview/HtmlPreview.js (1)
56-72: Consider adding indentation to JSON.stringify for better readability.Objects are currently stringified without indentation (
JSON.stringify(data, null)), which renders them as a single line. For improved readability, consider adding an indent level:♻️ Proposed refactor
} else if (typeof data === 'object') { - displayContent = JSON.stringify(data, null); + displayContent = JSON.stringify(data, null, 2); } else {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultPreview/HtmlPreview.jspackages/bruno-app/src/utils/common/index.jspackages/bruno-app/src/utils/response/index.js
💤 Files with no reviewable changes (2)
- packages/bruno-app/src/utils/response/index.js
- packages/bruno-app/src/utils/common/index.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions.() => {}is good
No space between function name and parentheses.func()notfunc ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly
Files:
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultPreview/HtmlPreview.js
🧠 Learnings (1)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.
Applied to files:
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultPreview/HtmlPreview.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Unit Tests
- GitHub Check: CLI Tests
- GitHub Check: Playwright E2E Tests
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - Windows
- GitHub Check: SSL Tests - macOS
🔇 Additional comments (2)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultPreview/HtmlPreview.js (2)
2-2: LGTM: Import simplification aligns with validation removal.The import statement correctly retains only
escapeHtml, which is still needed for safe base URL insertion.
33-54: No action required - the routing logic prevents the issue identified in the review.HtmlPreview is only rendered when
selectedFormat === 'html'orselectedFormat === 'javascript'(QueryResult/index.js). Plain text responses are explicitly routed to TextPreview viaselectedFormat === 'raw'(preview-text mode). Thetypeof data === 'string'check is appropriate for HTML content since it's explicitly selected by the user. The component also includes proper fallback handling for non-string data types (lines 56-72).Likely an incorrect or invalid review comment.
…ndered in webview
…omponent logic (#6730) * refactor: remove HTML validation functions and simplify HtmlPreview component logic * chore: fix playwright - removed body value check since response is rendered in webview --------- Co-authored-by: Bijin A B <bijin@usebruno.com>
Description
Remove HTML validation functions and simplify HtmlPreview component logic.
Closes #6709
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
✏️ Tip: You can customize this high-level summary in your review settings.