Conversation
|
@dqnamo is attempting to deploy a commit to the cossistant Team on Vercel. A member of the Team first needs to authorize it. |
Greptile OverviewGreptile SummaryThis PR adds a small CTA to the Facehash landing page: a client-side button that copies a pre-written “AI prompt” (installation + usage notes) to the clipboard, and wires it into the hero section of The change is isolated to the landing app UI: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant P as Home page (page.tsx)
participant B as CopyAiPromptButton
participant C as navigator.clipboard
U->>P: Render landing page
P->>B: Render <CopyAiPromptButton />
U->>B: Click "copy ai prompt" button
B->>C: writeText(MARKDOWN)
alt writeText succeeds
C-->>B: Promise resolves
B->>B: setCopied(true)
B->>B: setTimeout(2s) -> setCopied(false)
else writeText fails
C-->>B: Promise rejects
B-->>U: Unhandled rejection (current)
end
|
| const handleCopy = async () => { | ||
| await navigator.clipboard.writeText(MARKDOWN); | ||
| setCopied(true); | ||
| setTimeout(() => setCopied(false), 2000); | ||
| }; |
There was a problem hiding this comment.
Unhandled clipboard failure
navigator.clipboard.writeText can throw (e.g., non-secure context, denied permission, unsupported API). Since the handler doesn’t catch errors, clicking the button can produce an unhandled promise rejection and still schedules state changes. Consider wrapping the copy in a try/catch and only toggling copied on success (optionally provide a fallback message).
| const handleCopy = async () => { | ||
| await navigator.clipboard.writeText(MARKDOWN); | ||
| setCopied(true); | ||
| setTimeout(() => setCopied(false), 2000); | ||
| }; |
There was a problem hiding this comment.
Timeout set after unmount
The setTimeout(() => setCopied(false), 2000) isn’t cleared if the component unmounts within 2s, which can trigger React warnings about state updates on unmounted components. Store the timeout id and clear it in an effect cleanup.
Have been looking for a quick way to add facehash to projects. Not sure on the best place to put this on the page tho tbh

