FormidableLabs / victory

A collection of composable React components for building interactive data visualizations
http://commerce.nearform.com/open-source/victory/
Other
11k stars 525 forks source link

Warning: Failed prop type: Cannot read properties of undefined (reading 'hasOwnProperty') with NextJS #2052

Closed monsieurnebo closed 6 months ago

monsieurnebo commented 2 years ago

Bugs and Questions

Checklist

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

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

alfianwahid commented 2 years ago

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

tsachit commented 2 years ago

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

becca-bailey commented 2 years ago

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.

becca-bailey commented 2 years ago

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.

monsieurnebo commented 2 years ago

@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 🤯

wnvuong commented 2 years ago

i'm also having this issue with react native

monsieurnebo commented 2 years ago

@becca-bailey Did you have the time to dig into this issue by any chance? :)

cpandya231 commented 2 years ago

@becca-bailey it is really flooding the console and make debugging difficult, I will be happy to help if you can give me directions. 🙂

becca-bailey commented 2 years ago

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?

monsieurnebo commented 2 years ago

@becca-bailey Thanks for your time.

I just took a look at your Sandbox, and the error is here (console tab, not terminal):

image
jessegong37110 commented 2 years ago

Same here, is there any fix available ?

 ERROR  Warning: Failed prop type: undefined is not an object (evaluating 'checkerResult.data.hasOwnProperty')
VictoryArea
becca-bailey commented 2 years ago

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.

rassemdev commented 2 years ago

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.

acharyakavita commented 9 months ago

@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 ?

github-actions[bot] commented 6 months ago

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.

github-actions[bot] commented 6 months ago

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.