Skip to content
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

🐛 BUG: two instances of the same React component taking different props on an .astro page both render with the same props #844

Closed
sarah11918 opened this issue Jul 24, 2021 · 2 comments · Fixed by #846

Comments

@sarah11918
Copy link
Member

What package manager are you using?

npm (on CodeSandbox)

What operating system are you using?

ChromeOS

Describe the Bug

Two separate instances of a component (each with different props) that displays a user's most recent tweet on the same Astro page end up rendering two individual tweet displays (as expected) however they are both of the same (second) user (unexpected).

(NB: When the HTML is inspected, both components' astro-root uid are identical.)

Steps to Reproduce

  1. install react-twitter-widgets
  2. Create a React component that accepts props.
    eg:
    `import React from "react";
    import { Timeline } from "react-twitter-widgets";

const RecentTweet = ({ user }) => (
<>


<Timeline
dataSource={{
sourceType: "profile",
screenName: user
}}
options={{
width: "100",
tweetLimit: "1"
}}
/>

</>
);

export default RecentTweet;`

  1. on an Astro page, import, render multiple instances of that component, using different props for each component
    eg
    `
` 3. Error! Instead of the .astro page rendering two different Tweets, one from each user... two identical Tweets are rendered, both from user2's Twitter profile.

Screenshot 2021-07-24 18 15 20

Screenshot 2021-07-24 19 11 06

Link to Minimal Reproducible Example (Optional)

No response

@matthewp
Copy link
Contributor

Thanks, someone submitted a fix in #846.

@Kilian
Copy link

Kilian commented Dec 30, 2021

I'm currently running into this issues with Astro 0.22.2 on this site: https://tender-carson-79d420.netlify.app/ the three tickers on this page all get instantiated with different props, yet they all end up with the same astro-root uid and props (According to the react dev tools)

Is this fix in Astro 0.22.2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants