Skip to content

Make CopyPromptButton default prompt self-contained again - #514

Merged
dprevoznik merged 1 commit into
mainfrom
hypeship/copy-prompt-button-self-contained
Aug 21, 2026
Merged

Make CopyPromptButton default prompt self-contained again#514
dprevoznik merged 1 commit into
mainfrom
hypeship/copy-prompt-button-self-contained

Conversation

@dprevoznik

@dprevoznik dprevoznik commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The homepage's copy-prompt button is broken in production with ReferenceError: DEFAULT_PROMPT is not defined, thrown from CopyPromptButton's per-page render.
  • Add Foreman integration guide to Vercel section #510 hoisted the button's default prompt text out of the function body into a module-level DEFAULT_PROMPT const so the new Foreman page could override it via props. That constant isn't resolving wherever this snippet gets evaluated per-page, which breaks the homepage's no-props usage while the Foreman page (which always passes an explicit prompt) is unaffected.
  • Fix CopyPromptButton crashing when rendered with no props #513 fixed a related but different bug (destructuring a null props object) without touching where DEFAULT_PROMPT lives, so the ReferenceError was still live after that merged.

Fix

Move the default prompt text back inside CopyPromptButton's function body — the same shape it had before #510 — instead of a module-level constant, while keeping the prompt/label override the Foreman page relies on. No more identifier needs to resolve outside the function's own scope.

Test plan

  • Read through both call sites (index.mdx homepage, integrations/vercel/foreman.mdx) to confirm the override path still works with only props.prompt set and label on its default.
  • Could not run mintlify dev in this sandbox to visually confirm; the previous fix (Fix CopyPromptButton crashing when rendered with no props #513) looked correct under local JS semantics but didn't reproduce the actual production error, so this should be spot-checked on preview once deployed.

Note

Low Risk
Small docs-snippet scoping fix with no auth, data, or infrastructure impact. Override behavior for explicit prompt props is preserved.

Overview
Fixes a production ReferenceError: DEFAULT_PROMPT is not defined on the homepage copy-prompt button.

Moves the default prompt string back inside CopyPromptButton instead of a module-level DEFAULT_PROMPT. Callers can still pass prompt (Foreman) or omit it (homepage). label still defaults when props is missing.

Reviewed by Cursor Bugbot for commit 0754c28. Bugbot is set up for automated code reviews on this repo. Configure here.

#510 hoisted the homepage's default prompt text into a module-level
DEFAULT_PROMPT const so the Foreman page could override it via props.
That constant doesn't resolve in Mintlify's per-page render (Reference
Error: DEFAULT_PROMPT is not defined), breaking the homepage button.
#513 patched the destructuring but never touched DEFAULT_PROMPT's
scope, so the underlying failure was still live.

Move the default prompt text back inside the function body, matching
how it worked before #510, while keeping the prompt/label override
for the Foreman page.
@mintlify

mintlify Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Kernel 🟢 Ready View Preview Aug 21, 2026, 7:09 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@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.

Risk assessment: Low

Verdict: Approving. Single-file, isolated docs-snippet scoping fix with no auth, infra, or shared-library impact.

What changed

  • File: snippets/copy-prompt-button.jsx (+5/−5)
  • Moves the default copy-prompt string from a module-level DEFAULT_PROMPT into the component body, and binds prompt with (props && props.prompt) || <default> instead of a destructuring default.
  • The default prompt text is unchanged; only identifier scope and defaulting mechanics changed.
  • Call sites remain index.mdx (no prompt prop) and integrations/vercel/foreman.mdx (explicit prompt). Override path is preserved for a truthy props.prompt.

Why Low (not Medium+)

  • Blast radius is one Mintlify snippet used by two docs pages.
  • No CODEOWNERS file, no auth/billing/permissions, no schema or infra.
  • Not a prompt-content change: the LLM instruction string is identical; this is a JS scoping fix around an existing string.

Residual note (non-blocking)

Destructuring defaulted only on undefined; || also treats other falsy values (e.g. "") as missing. Neither current call site relies on a falsy prompt, so this is not a reason to withhold approval.

Action: Approve.

Open in Web View Automation 

Sent by Cursor Automation: Assign PR reviewers

@dprevoznik
dprevoznik merged commit ad277d8 into main Aug 21, 2026
4 checks passed
@dprevoznik
dprevoznik deleted the hypeship/copy-prompt-button-self-contained branch August 21, 2026 19:12
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