💸 Perf - Mount the Eventbrite Popup only when it opens - #4916
Open
isaaclombardssw wants to merge 2 commits into
Open
💸 Perf - Mount the Eventbrite Popup only when it opens#4916isaaclombardssw wants to merge 2 commits into
isaaclombardssw wants to merge 2 commits into
Conversation
Each Eventbrite CTA mounted a react-responsive-modal instance unconditionally so the close animation could play. On the AI for Business Leaders page that is 8 live modals at first paint. Gate the Popup behind a `hasOpened` flag: nothing mounts until a CTA is clicked, and once opened it stays mounted so the close transition still runs. The script-defer, widget reset, and eventbrite_order_complete conversion tracking are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q8genJyZboXaa4vgYhJF4P
Contributor
Coverage report
Test suite run success19 tests passing in 2 suites. Report generated by 🧪jest coverage report action from ff2add3 |
isaaclombardssw
marked this pull request as ready for review
July 23, 2026 07:12
Member
Author
|
This is going to be marginal in terms of perf gains, but harmless cleanup |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves initial render performance for pages with multiple Eventbrite CTAs by deferring creation of each react-responsive-modal instance until the user actually opens that CTA at least once, while preserving the close animation behavior.
Changes:
- Add a
hasOpened(“has ever opened”) state flag to gate rendering of thePopup. - Update the CTA click handler to set
hasOpenedand then open the modal. - Keep the modal mounted after first open so close transitions still run, but avoid mounting any modal/portal DOM on first paint.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4904
Each Eventbrite CTA mounted a
react-responsive-modalPopupunconditionally — the old comment kept it always-mounted so the close animation could play. On the AI for Business Leaders page (blocks 5 and 37, eightEmbeddedCardButtons) that means eight live modal instances at first paint.Change
components/eventbrite/eventbriteModalButton.tsxnow gates thePopupbehind ahasOpenedflag:hasOpenedisfalse, so{hasOpened && <Popup />}renders nothing — noreact-responsive-modalinstance, no portal, no iframe.hasOpened(andopen)true, mounting the Popup and playing the enter animation.The deferred script load, the "don't stack a second iframe" guard, the script-timeout fallback link, and the
eventbrite_order_completeconversion tracking (sendGTMEvent) are all untouched.This is option 1 from the issue (a "has ever opened" flag), the smallest of the three proposed approaches — no page-level refactor, no dep changes.
Verified
pnpm lintclean (only the pre-existingz-[2]Tailwind warning).npx prettier --checkon the changed file clean.npx tsc --noEmitreports no errors for this file (remaining project errors are the pre-existing@/tina/clientre-export that only the full dev server emits).hasOpenedfalse the Popup subtree is not rendered, so no modal DOM or iframe exists until a CTA is clicked; reopening after close re-runs the same open path.Left for a human
pnpm devbuild is memory-heavy in this environment so I verified by code trace and static checks rather than a live click-through.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q8genJyZboXaa4vgYhJF4P