Skip to content

Comments

fix: use createPortal for FeatureOptInBanner to avoid Intercom widget conflict#27121

Merged
dhairyashiil merged 2 commits intomainfrom
devin/1769077389-feature-opt-in-banner-portal
Jan 26, 2026
Merged

fix: use createPortal for FeatureOptInBanner to avoid Intercom widget conflict#27121
dhairyashiil merged 2 commits intomainfrom
devin/1769077389-feature-opt-in-banner-portal

Conversation

@eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Jan 22, 2026

What does this PR do?

Renders the FeatureOptInBanner component using React's createPortal to document.body instead of inline rendering. This prevents z-index/stacking context conflicts with the Intercom widget, which is also positioned at the bottom of the viewport.

Updates since last revision

Added SSR guard (typeof document !== "undefined") before accessing document.body in createPortal to prevent crashes in SSR/test environments where document is undefined. This addresses the Cubic AI review feedback.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - no documentation changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Enable a feature that shows the opt-in banner (e.g., a feature flag that triggers FeatureOptInBannerWrapper)
  2. Ensure the Intercom widget is also visible on the page
  3. Verify the banner appears correctly and doesn't overlap/conflict with the Intercom widget
  4. Test banner interactions (dismiss button, opening the dialog)

Checklist

  • My code follows the style guidelines of this project
  • I have checked if my changes generate no new warnings

Human Review Checklist

  • Verify no SSR/hydration issues - Added typeof document !== "undefined" guard to prevent SSR crashes
  • Confirm banner positioning and functionality remain intact after portal change

Link to Devin run: https://app.devin.ai/sessions/c98fd1129fcf4f73bccc4900e86ec685
Requested by: @eunjae-lee

… conflict

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@eunjae-lee eunjae-lee marked this pull request as ready for review January 22, 2026 11:01
@graphite-app graphite-app bot added core area: core, team members only consumer labels Jan 22, 2026
@graphite-app graphite-app bot requested a review from a team January 22, 2026 11:01
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/features/feature-opt-in/components/FeatureOptInBannerWrapper.tsx">

<violation number="1" location="packages/features/feature-opt-in/components/FeatureOptInBannerWrapper.tsx:44">
P2: Guard portal rendering against non-browser environments; accessing `document.body` during render can crash SSR/tests when `document` is undefined.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Contributor

Devin AI is addressing Cubic AI's review feedback

A Devin session has been created to address the issues identified by Cubic AI.

View Devin Session

Add typeof document check before accessing document.body in createPortal
to prevent SSR/test crashes when document is undefined.

Co-Authored-By: unknown <>
@dhairyashiil dhairyashiil enabled auto-merge (squash) January 26, 2026 13:55
@keithwillcode keithwillcode added this to the v6.2 milestone Jan 26, 2026
@dhairyashiil dhairyashiil merged commit 1e31ac0 into main Jan 26, 2026
80 of 82 checks passed
@dhairyashiil dhairyashiil deleted the devin/1769077389-feature-opt-in-banner-portal branch January 26, 2026 14:07
@github-actions
Copy link
Contributor

E2E results are ready!

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

Labels

consumer core area: core, team members only ready-for-e2e size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants