Repository navigation
fix(ai): render AI assist popup via portal to prevent clipping by response pane - #8463
naman-bruno merged 2 commits into
Conversation
WalkthroughThe AIAssist popup is refactored from a manually rendered conditional div to a Tippy-driven portal component. Styling is moved to a new exported ChangesAIAssist Popup Migration to Tippy
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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: 1
🧹 Nitpick comments (1)
packages/bruno-app/src/components/AIAssist/index.js (1)
72-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffFocus logic is duplicated with
onShow; consider consolidating.The focus effect (Lines 73-77) re-focuses
.popup-inputon open, whichonShow's rAF (Lines 177-181) already handles. The only path unique to this effect is the preview→prompt transition. Both effects are also pure side-effects that could live in a small custom hook (e.g.usePopupKeyboard/usePopupFocus) to keep the component lean.As per coding guidelines: "MUST: Prefer custom hooks for business logic, data fetching, and side-effects in React".
🤖 Prompt for 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. In `@packages/bruno-app/src/components/AIAssist/index.js` around lines 72 - 90, The focus behavior in AIAssist/index.js is duplicated between the opening effect and the existing onShow handler, so consolidate it into a single focus path and keep only the preview-to-prompt special case in the effect. Move the side-effect logic into a small custom hook such as usePopupFocus or usePopupKeyboard, and have the component use that hook instead of managing focus directly. Keep the unique symbols useEffect, onShow, and tippyRef.current?.popper?.querySelector('.popup-input') as the places to update.Source: Coding guidelines
🤖 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/components/AIAssist/index.js`:
- Around line 182-185: The AIAssist popup hide handler currently only closes the
panel and clears the error, so an in-flight generation can keep running and
stale prompt/preview state can reappear on reopen. Update the onHide logic in
AIAssist to also stop/cancel the active stream or request and reset all
transient generation state so hiding always returns the component to a clean
slate. Use the existing AIAssist state setters and any stream control helpers in
that component to ensure both the request and UI state are cleared together.
---
Nitpick comments:
In `@packages/bruno-app/src/components/AIAssist/index.js`:
- Around line 72-90: The focus behavior in AIAssist/index.js is duplicated
between the opening effect and the existing onShow handler, so consolidate it
into a single focus path and keep only the preview-to-prompt special case in the
effect. Move the side-effect logic into a small custom hook such as
usePopupFocus or usePopupKeyboard, and have the component use that hook instead
of managing focus directly. Keep the unique symbols useEffect, onShow, and
tippyRef.current?.popper?.querySelector('.popup-input') as the places to update.
🪄 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: e50bbefc-c7ac-4e40-8dee-0ce56816fbd7
📒 Files selected for processing (3)
packages/bruno-app/src/components/AIAssist/StyledWrapper.jspackages/bruno-app/src/components/AIAssist/index.jspackages/bruno-app/src/components/AIAssist/index.spec.js
Description
Fixes an issue where the AI Assist Popup was clipped or appeared below by the response tab when using the horizontal layout. The Popup now correctly appears above the terminal, ensuring the complete AI-generated output remains visible across all AI-enabled tabs.
JIRA
Screenshot of the fix
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
New Features
Bug Fixes
Tests