-
Notifications
You must be signed in to change notification settings - Fork 292
fix: Copy button on blog post page not working #2623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: Copy button on blog post page not working #2623
Conversation
WalkthroughA single component file was modified to enhance copy-to-clipboard functionality. The change removes a dependency on the page state object and integrates a Tooltip component with melt UI library. The copy action now utilizes a state handler that tracks whether content has been copied, displaying dynamic tooltip text that reflects the current state—"Copied!" when the action completes, otherwise "Copy". The existing link-sharing behavior is preserved while non-link share actions receive improved interaction feedback. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/lib/components/blog/post-meta.svelte (1)
16-26: Consider guarding copy behavior whencurrentURLis emptyIf
currentURLcan ever be omitted or empty,handleCopy(currentURL, 2000)will cause the copy button to silently copy an empty string. You might want to either (a) makecurrentURLa required prop for this component, or (b) conditionally render/enable the copy UI only whencurrentURLis non-empty.Also applies to: 32-33
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/lib/components/blog/post-meta.svelte(3 hunks)
🔇 Additional comments (2)
src/lib/components/blog/post-meta.svelte (2)
7-8: Tooltip + Melt imports look correct for current usageImporting
Tooltipfrom your local components andmeltfrom@melt-ui/sveltealigns with how the button is wired later withuse:melt={trigger}; no changes needed here.
81-82: Copy button + tooltip wiring correctly addresses the original issueWiring the non-link share option to
onclick={copy}and driving the tooltip text from$copied ? 'Copied!' : 'Copy'gives clear feedback and should resolve the previously non-working copy button, assumingcurrentURLis populated. This also matches Svelte 5 runes-style event handling (onclick) and store usage.Also applies to: 95-107
What does this PR do?
The copy button on the blog post was not working (earlier)
Earlier
Now
Test Plan
There were no Test Plans
Related PRs and Issues
#2605
Have you read the [Contributing Guidelines on issues]
Yes
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.