Make CopyPromptButton default prompt self-contained again - #514
Merged
Conversation
#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.
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
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_PROMPTinto the component body, and bindspromptwith(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(nopromptprop) andintegrations/vercel/foreman.mdx(explicitprompt). Override path is preserved for a truthyprops.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.
Sent by Cursor Automation: Assign PR reviewers
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.


Summary
ReferenceError: DEFAULT_PROMPT is not defined, thrown fromCopyPromptButton's per-page render.DEFAULT_PROMPTconst 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 explicitprompt) is unaffected.nullprops object) without touching whereDEFAULT_PROMPTlives, so theReferenceErrorwas 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 theprompt/labeloverride the Foreman page relies on. No more identifier needs to resolve outside the function's own scope.Test plan
index.mdxhomepage,integrations/vercel/foreman.mdx) to confirm the override path still works with onlyprops.promptset andlabelon its default.mintlify devin 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
promptprops is preserved.Overview
Fixes a production
ReferenceError: DEFAULT_PROMPT is not definedon the homepage copy-prompt button.Moves the default prompt string back inside
CopyPromptButtoninstead of a module-levelDEFAULT_PROMPT. Callers can still passprompt(Foreman) or omit it (homepage).labelstill defaults whenpropsis missing.Reviewed by Cursor Bugbot for commit 0754c28. Bugbot is set up for automated code reviews on this repo. Configure here.