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 - Encountered two children with the same key #140

Open
LiveXenon opened this issue Feb 13, 2022 · 2 comments
Open

Bug - Encountered two children with the same key #140

LiveXenon opened this issue Feb 13, 2022 · 2 comments

Comments

@LiveXenon
Copy link

LiveXenon commented Feb 13, 2022

Encountered two children with the same key, 1. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

The problem appears when graph contains 2 or more equal y values, example:

        cost exampleData = [
            { x: 10, y: 1 },
            { x: 11, y: 1 }
        ]

Affected platforms: iOS and Android

@LiveXenon LiveXenon changed the title Encountered two children with the same key Bug - Encountered two children with the same key Feb 13, 2022
@lukasa1993
Copy link

any love for this ?

@moxie99
Copy link

moxie99 commented Jan 17, 2024

Yeah, I had the same error but I was able to get by it mapping through the data supplied to the chart first before passing it to chart helped. More like this :

cost exampleData = [
{ x: 10, y: 1 },
{ x: 11, y: 1 }
]

const areBidPricesSame = fundData.every((item) => item.y === exampleData[0].y);

if (areBidPricesSame) {
return (

All bid prices are the same, cannot render the chart.

);
}

return (
<Chart
data={exampleData.map((i, index) => ({
x: index + Math.random(),
y: i.y,
}))}

>
  
</Chart>

);
};

You can display a table once the y-axis has the same data otherwise the chart is displayed. This won't break your app.

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

No branches or pull requests

3 participants