saurabhnemade / react-twitter-embed

Simplest way to add twitter widgets to your react project.
https://saurabhnemade.github.io/react-twitter-embed/
367 stars 66 forks source link

Error when listing TwitterTweetEmbed #49

Open Felix83000 opened 4 years ago

Felix83000 commented 4 years ago

Hi !

I tried to list several tweets but when I updated the "IdList", the component did not update correctly and some previous tweets stayed with the new.

The code:

   this.getIdList().map((id, index) => (
                       <TwitterTweetEmbed
                           key={index}
                           tweetId={id}
                           options={{
                               cards: 'hidden',
                               conversation: 'none',
                               width: '100%',
                           }}  
                       />
                   ))

I tried with an outdated component named "react-twitter-widgets" and it works perfectly with the same logic:

this.getIdList().map((id, index) => (
                    <Tweet
                        key={index}
                        tweetId={id}
                        options={{
                            cards: 'hidden',
                            conversation: 'none',
                            width: '100%',
                        }}
                    />
                ))
saurabhnemade commented 4 years ago

@Felix83000 Thanks for reporting. 👍

To support this, wee just need to check if previous and next props are changed in react and if change is present then reinitialise the twitter instance. I might fix this in future but will definitely take some time to get it replicated for every component.