victory
victory copied to clipboard
Warning: Failed prop type: Cannot read properties of undefined (reading 'hasOwnProperty') with NextJS
Bugs and Questions
Checklist
-
[x] I have read through the FAQ and Guides before asking a question
-
[x] I am using the latest version of Victory
-
[x] I've searched open issues to make sure I'm not opening a duplicate issue
The Problem
Victory components (VictoryChart, VictoryBar, ...) usage triggers the following error when used with NextJS:
Warning: Failed prop type: Cannot read properties of undefined (reading 'hasOwnProperty')
Reproduction
You can take a look to this basic example on CodeSandbox.
Feature Requests
Checklist
-
[x] I've read through the Docs and Guides to make sure this functionality doesn't already exist
-
[x] I've searched open issues to make sure I'm not opening a duplicate issue
Description
The error started with victory v36.2.0
.
This error should be fixed to avoid log pollution.
It seems to be triggered by the following code (shouldComponentUpdate
).
Seems specific to SSR because of the error absence in pure React.
Thanks for the hard work 🙏
Related issues
https://github.com/vercel/next.js/issues/1412 https://github.com/FormidableLabs/victory/issues/516
after upgrade victory-native 35.5.5 to 36.2.0, I got this error
ERROR Warning: Failed prop type: Cannot read property 'hasOwnProperty' of undefined
at VictoryAxis
in VictoryChart (created by VictoryChart)
React-Native 0.66.4
after upgrade victory-native 35.5.5 to 36.2.0, I got this error
ERROR Warning: Failed prop type: Cannot read property 'hasOwnProperty' of undefined at VictoryAxis in VictoryChart (created by VictoryChart)
React-Native 0.66.4
I've been seeing this on 35.5.5 since few days
Hmm, this is a tricky one! I can see the error on the code sandbox linked above, but so far I haven't been able to reproduce the same issue in my own next.js code sandbox or local project. The issue seems to resolve itself once I switch to any other version of victory, but also doesn't re-appear once I re-install 35.6.2. I'm going to continue to look into this, but I'm also adding a "help wanted" label here in case anyone else has ideas!
Historically, it does seem like the higher-order components have been a bit problematic with next.js
, but I'm not aware of any changes in 35.6.2 that would have affected this on our end.
In the reproduction it is appearing as a prop type warning, but it is not preventing the build from succeeding. Is anyone experiencing this as a build error? I'll look into it either way, but I'm just trying to determine the priority for addressing it.
@becca-bailey Thanks for digging in. We only encountered as a prop type error.
I understand that's less of a priority than a build error, but I hope it will be fixed anyway because this is causing false positive when we want to debug stuff in runtime 🤯
i'm also having this issue with react native
@becca-bailey Did you have the time to dig into this issue by any chance? :)
@becca-bailey it is really flooding the console and make debugging difficult, I will be happy to help if you can give me directions. 🙂
I can see the error in the code sandbox link above (thanks for the reproduction!), however I can't reproduce it locally with create-next-app
or see the same error if I upgrade Victory to the latest version (36.3.1). Here's my current sandbox. https://codesandbox.io/s/charming-cannon-tqnjez
If you are seeing this error - can try to upgrade to the latest version of Victory?
@becca-bailey Thanks for your time.
I just took a look at your Sandbox, and the error is here (console tab, not terminal):

Same here, is there any fix available ?
ERROR Warning: Failed prop type: undefined is not an object (evaluating 'checkerResult.data.hasOwnProperty')
VictoryArea
This has been reported as a bug, but no fix is available yet. If anyone here would like to tackle this issue, PRs are welcome.
This has been reported as a bug, but no fix is available yet. If anyone here would like to tackle this issue, PRs are welcome.
Also having this same error.
@rassemdev I was unsuccessful in recreating this issue with the latest version of victory and NextJs. Also the code sandbox examples shared above is not working anymore. Can you please check if this is occuring again ?
This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.