Skip to content

chore(calendly): address CodeRabbit follow-ups from #750 - #758

Merged
harlan-zw merged 1 commit into
mainfrom
fix/calendly-followups
May 8, 2026
Merged

chore(calendly): address CodeRabbit follow-ups from #750#758
harlan-zw merged 1 commit into
mainfrom
fix/calendly-followups

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Follow-up to #750.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Three issues raised by CodeRabbit on #750 that landed after the squash-merge:

🟠 Major: stylesheet disappears after SPA navigation

The cssInjected module-level flag short-circuited ensureCalendlyStylesheet() after first injection. But because the useHead call runs inside the composable's setup(), the entry is component-scoped — unhead removes the <style> on unmount. On the next visit the flag still said "already injected", so the widget loaded unstyled.

Fix: drop the flag and rely on key deduplication. Multiple components on the same page calling useHead with the same key are safely collapsed to one <style> tag, and the entry follows the component lifecycle correctly across SPA navigations.

🟡 Minor: watch on status missed pre-existing 'error' state

A shared useScriptCalendly() instance that already failed (e.g. on a prior navigation) won't re-fire status change on a new component mount. The component never emits error for the existing failure. Added { immediate: true }.

🟡 Minor: CalendlyPageSettings missing hideGdprBanner

Calendly's SDK accepts it; the component's local copy of the interface had it but the registry's exported one didn't, so callers composing CalendlyInlineWidgetOptions / CalendlyPopupWidgetOptions directly couldn't pass the flag type-safely.

✅ Verification

  • All Calendly e2e + unit + typecheck tests pass locally.
  • SPA-navigation regression manually reproducible before the fix (navigate away from /third-parties/calendly/nuxt-scripts, navigate back → <style> was missing); fixed after.

Three issues raised after the squash-merge of the Calendly PR:
1. **(major) Stylesheet disappears after SPA navigation.** The
`cssInjected` module-level flag short-circuited
`ensureCalendlyStylesheet()` after first injection. But because the
`useHead` call runs inside the composable's `setup()`, the entry is
component-scoped — unhead removes the `<style>` on unmount. On the
next visit the flag still says "already injected", so the widget
loaded unstyled. Drop the flag and rely on `key` deduplication.
2. **(minor) Watch on `status` missed pre-existing error state.** A
shared `useScriptCalendly()` instance that already failed (e.g. on a
prior navigation) won't re-fire `status` change on a new component
mount. Add `{ immediate: true }` so the component emits `error`
when it encounters an already-failed instance.
3. **(minor) `CalendlyPageSettings` missing `hideGdprBanner`.**
Calendly's SDK accepts it; the component's local copy of the
interface had it but the registry's exported one didn't, so callers
composing `CalendlyInlineWidgetOptions` / `CalendlyPopupWidgetOptions`
directly couldn't pass the flag type-safely.
@vercel

vercelBot commented May 8, 2026

Copy link
Copy Markdown
Contributor

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

ProjectDeploymentActionsUpdated (UTC)
scripts-playgroundReadyReadyPreview, CommentMay 8, 2026 7:03am

@coderabbitai

coderabbitaiBot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This pull request makes two focused improvements to the Calendly widget integration. First, the status watcher in ScriptCalendlyInlineWidget.vue is configured to run immediately with { immediate: true }, allowing error events to be emitted during component setup rather than waiting for the first status change. Second, the stylesheet injection function in the registry is simplified by removing a persistent cssInjected module flag and instead relying solely on import.meta.server to detect server-side rendering, with useHead called unconditionally on the client.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title uses 'chore' but the objectives describe functional fixes addressing three issues (stylesheet re-injection, watcher immediacy, type export). The title is partially related as it references the follow-up PR, but doesn't reflect the actual fix nature or scope.Use 'fix(calendly)' instead of 'chore(calendly)' to accurately reflect that this addresses functional issues, not maintenance tasks.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description check✅ PassedThe description is comprehensive and directly related to the changeset, detailing the three issues fixed and how each was resolved.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/calendly-followups

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-newBot commented May 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/scripts@758

commit: 22dcf49

@harlan-zwharlan-zw changed the title fix(calendly): address CodeRabbit follow-ups from #750chore(calendly): address CodeRabbit follow-ups from #750May 8, 2026
@harlan-zw
harlan-zw merged commit 727e025 into mainMay 8, 2026
19 checks passed
@harlan-zw
harlan-zw deleted the fix/calendly-followups branch May 8, 2026 07:19
Sign up for freeto 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

@harlan-zw