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

Undefined containerComponent results in TypeError #2848

Closed
2 tasks done
jesper-stighem-pini opened this issue Apr 3, 2024 · 2 comments · Fixed by #2852
Closed
2 tasks done

Undefined containerComponent results in TypeError #2848

jesper-stighem-pini opened this issue Apr 3, 2024 · 2 comments · Fixed by #2852
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@jesper-stighem-pini
Copy link

jesper-stighem-pini commented Apr 3, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Mentioned here: #2748 (comment)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Victory version

37.0.1

Code Sandbox link

https://codesandbox.io/p/sandbox/victory-starter-forked-cyh3wf

Bug report

We have a custom container on a chart that we want to use in some views, but not all. Setting containerComponent to undefined however crashes the application (TypeError) as Victory tries to read containerComponent.props.

<VictoryChart containerComponent={condition ? <CustomContainer/> : undefined}>
  <VictoryLine />
</VictoryChart>

Expected behavior

We expected containerComponent={undefined} to behave as if no containerComponent was set.

We thought this:

<VictoryChart containerComponent={undefined}>
  <VictoryLine />
</VictoryChart>

Should work as this:

<VictoryChart>
  <VictoryLine />
</VictoryChart>
@jesper-stighem-pini jesper-stighem-pini added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Apr 3, 2024
@madox2
Copy link

madox2 commented Apr 4, 2024

Same issue after upgrade from 36.6.11 to 36.9.2. I was able to workaround by spreading an object:

<VictoryChart {...(condition ? { containerComponent: <CustomContainer /> } : {})}>
  <VictoryLine />
</VictoryChart>

@carbonrobot carbonrobot added the Issue: Accepted The submitted issue has been confirmed by the Victory core team label Apr 4, 2024
@carbonrobot
Copy link
Contributor

Will be released in 37.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants