victory icon indicating copy to clipboard operation
victory copied to clipboard

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

Open monsieurnebo opened this issue 3 years ago • 14 comments

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

monsieurnebo avatar Jan 04 '22 17:01 monsieurnebo

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

alfianwahid avatar Jan 05 '22 23:01 alfianwahid

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

tsachit avatar Jan 06 '22 16:01 tsachit

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 avatar Jan 14 '22 20:01 becca-bailey

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 avatar Jan 14 '22 20:01 becca-bailey

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

monsieurnebo avatar Jan 15 '22 10:01 monsieurnebo

i'm also having this issue with react native

wnvuong avatar Mar 03 '22 13:03 wnvuong

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

monsieurnebo avatar Mar 03 '22 13:03 monsieurnebo

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

cpandya231 avatar Mar 08 '22 05:03 cpandya231

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 avatar Mar 14 '22 22:03 becca-bailey

@becca-bailey Thanks for your time.

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

image

monsieurnebo avatar Mar 15 '22 08:03 monsieurnebo

Same here, is there any fix available ?

 ERROR  Warning: Failed prop type: undefined is not an object (evaluating 'checkerResult.data.hasOwnProperty')
VictoryArea

jessegong37110 avatar Mar 29 '22 21:03 jessegong37110

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.

becca-bailey avatar Mar 29 '22 23:03 becca-bailey

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 avatar Aug 19 '22 13:08 rassemdev

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

acharyakavita avatar Jan 04 '24 09:01 acharyakavita

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] avatar Apr 04 '24 00:04 github-actions[bot]

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.

github-actions[bot] avatar Apr 12 '24 00:04 github-actions[bot]