refactor: simplify SocialShareButton – remove client‑side fallback UI#93
refactor: simplify SocialShareButton – remove client‑side fallback UI#93amankv1234 wants to merge 1 commit into
Conversation
Walkthrough
ChangesSocial Share Button Widget Cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/SocialShareButton.jsx`:
- Around line 32-59: The SocialShareButton initialization in useEffect is
relying on a one-time synchronous window.SocialShareButton check, which can run
before the deferred widget script is available. Update the SocialShareButton
component to wait for script availability using a robust readiness strategy such
as DOMContentLoaded or short polling, and only instantiate the widget once
window.SocialShareButton and containerRef.current are both ready. Keep the
existing props passed into new window.SocialShareButton intact, and make sure
the effect can recover if the widget loads after the first render instead of
only logging a warning.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 34d4ab24-93b6-4a8c-861b-02d43e04c243
📒 Files selected for processing (1)
src/components/SocialShareButton.jsx
kpj2006
left a comment
There was a problem hiding this comment.
lgtm
@amankv1234 pls share a video with @rahul-vyas-dev
|
@rahul-vyas-dev , https://drive.google.com/file/d/1MI80S5uUce3laciKMA-AW-W1SR4t2_df/view?usp=sharing |
📌 Summary
This PR simplifies the
SocialShareButtoncomponent by removing client‑side error‑fallback UI and unused dependencies. The component now:useRefanduseEffect.onCopyprop and related fallback logic.<div ref={containerRef}></div>for the widget to mount into.✅ Why this change?
🔧 Issue
Closes #88
📦 Testing
npm run devand verify the “Share” button still works on pages that load the widget.Summary by CodeRabbit