justinmahar / react-social-media-embed

📰 Easily embed social media posts from Facebook, Instagram, LinkedIn, Pinterest, TikTok, X (Twitter), and YouTube in React.
https://justinmahar.github.io/react-social-media-embed/
MIT License
225 stars 31 forks source link

FB embed is not working #83

Open sa7bi-tx opened 2 months ago

sa7bi-tx commented 2 months ago

Hi, First of all, thank you for your excellent work on this library. We have an issue with the FB embed where reloading the page multiple times will crash the app. You can even see it here, by reloading the page, you'll get :

init not called with valid version

CleanShot 2024-08-23 at 09 32 16@2x

I have tried cloning the repo locally and changing the FB sdk's version, but that doesn't seem to resolve it.

adnahl commented 2 months ago

Try changing the embed script version: 19,18,17 on .../FacebookEmbed.tsx

const embedJsScriptSrc = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v19.0'

rdiazroman commented 2 months ago

I have tried cloning the repo locally and changing the FB sdk's version, but that doesn't seem to resolve it.

we tried that but didn't work... there is also another side effect probably. On a page, with FB and Insta embeds...if the FB one comes before insta...the insta one gets loading forever. Happens only on initial load (try in incognito). After page refresh is fine.

https://disc-3068.dev.tagesanzeiger.ch/tets-8457-this-article-has-some-polls-update-400690935676

can someone check please? thank you!

sa7bi-tx commented 2 months ago

Try changing the embed script version: 19,18,17 on .../FacebookEmbed.tsx

const embedJsScriptSrc = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v19.0'

Thanks @adnahl for your comment. If you try to clone the repo and change that line as you suggested, you'll see that the main example for the FacebookEmbed section won't work after a second refresh.

marcfrankel commented 1 month ago

Any solution to this issue? Also running into the exact same problem

marcfrankel commented 1 month ago

Adding extra context that the most recent version of the sdk.js is v20.0, but patching the URL to that version doesn't help. Seemingly if the page uses a cached version of the script in the browser then it breaks on reload.