Skip to content

fix(demo): preload the Cal.com booking embed while the visitor fills the form#5616

Merged
waleedlatif1 merged 2 commits into
stagingfrom
worktree-fix-calendly-demo-slowness
Jul 12, 2026
Merged

fix(demo): preload the Cal.com booking embed while the visitor fills the form#5616
waleedlatif1 merged 2 commits into
stagingfrom
worktree-fix-calendly-demo-slowness

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The demo page's Cal.com calendar took several seconds to appear after submitting the booking form: nothing embed-related (embed.js, the booker iframe, its assets) started downloading until the visitor pressed Continue
  • Warm the entire path on first form focus using the embed's documented preload instruction — it caches the booker's assets in a hidden ?preload=true iframe while the visitor fills the form
  • Add a preconnect to app.cal.com (React 19 react-dom API) so the first embed request skips connection setup
  • Zero Cal.com traffic at initial page load, so Lighthouse/LCP are untouched; verified with Playwright — the calendar now finishes loading ~815ms after submit instead of starting cold

Type of Change

  • Bug fix

Testing

Tested manually with Playwright against the running app: confirmed no cal.com requests on page load, preload iframe attaches ~200ms after first form focus, and the booker renders fully ~815ms after submit

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…the form

The embed script, booker iframe, and its assets only started downloading
after the visitor pressed Continue, so the calendar took several seconds
to appear. Warm the whole path on first form focus via the embed's
documented preload instruction (hidden ?preload=true iframe caches the
booker assets) plus a preconnect to app.cal.com. Nothing Cal.com-related
loads at initial page load, so Lighthouse/LCP are untouched.
@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 12, 2026 2:47am

Request Review

@cursor

cursor Bot commented Jul 12, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Landing demo UX only; lazy-loading and no Cal.com requests on first paint are preserved, with limited surface area.

Overview
Fixes slow Cal.com calendar appearance after demo form submit by warming the booking path on first form focus instead of only lazy-loading the scheduler chunk.

DemoBooking now calls preloadScheduler() on onFocusCapture, which uses React 19 preconnect('https://app.cal.com'), dynamically imports the scheduler module, and invokes new preloadCalEmbed(). That helper loads Cal.com embed.js and runs the embed API’s preload instruction (hidden booker iframe) with idempotent guards and retry on failed script load. Initial page load still avoids Cal.com traffic; embed work overlaps form fill time.

Reviewed by Cursor Bugbot for commit 9e49846. Configure here.

Comment thread apps/sim/app/(landing)/demo/components/demo-scheduler/demo-scheduler.tsx Outdated
@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR preloads the Cal.com demo scheduler after the visitor starts the form.

  • Moves the Cal.com preconnect into the focus-triggered preload path.
  • Loads the scheduler chunk before the booking step is shown.
  • Adds a preloadCalEmbed helper for the Cal.com embed preload instruction.
  • Re-exports the scheduler preload helper from the scheduler barrel.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/app/(landing)/demo/components/demo-booking/demo-booking.tsx Moves the Cal.com preconnect into preloadScheduler, which runs from the existing form focus preload path.
apps/sim/app/(landing)/demo/components/demo-scheduler/demo-scheduler.tsx Adds preloadCalEmbed to load the Cal.com embed API and issue the scheduler preload instruction.
apps/sim/app/(landing)/demo/components/demo-scheduler/index.ts Exports preloadCalEmbed alongside DemoScheduler for the lazy preload path.

Reviews (2): Last reviewed commit: "fix(demo): retry embed warm-up on failur..." | Re-trigger Greptile

Comment thread apps/sim/app/(landing)/demo/components/demo-booking/demo-booking.tsx Outdated
…ocus

Reset the preload guard when embed.js fails to load so a later focus can
retry, and move the app.cal.com preconnect from render into the
focus-triggered preload path so initial page load makes zero Cal.com
connections.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9e49846. Configure here.

@waleedlatif1 waleedlatif1 merged commit a2f868c into staging Jul 12, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the worktree-fix-calendly-demo-slowness branch July 12, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant