question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Vue warn]: Invalid prop: type check failed for prop "chartData"

See original GitHub issue

Expected Behavior

Absence of warning )

Possible answer

Can’t understand the reason it’s present. But after changing in https://vue-chartjs.org/guide/#example props: ['chartData', 'options'], to props: ['options'], warn goes away. I thought it’s already added in mixin. What’s wrong?


Update: Oh, due adding chartData it seems i’m overriding mixins validation. The root of evil is that the nested component renders firstly when props still null. After changing mounted hook to created in RandomChart.vue warn is gone.

https://medium.com/@brockreece/vue-parent-and-child-lifecycle-hooks-5d6236bd561f

Actual Behavior

[Vue warn]: Invalid prop: type check failed for prop "chartData". Expected Object, got Null 

found in

---> <RateChart> at app/javascript/RateChart.vue
       <RatePage> at app/javascript/RatePage.vue
         <Root>

in vue.runtime.esm.js:640

Environment

  • vue.js version: 2.6.10
  • vue-chart.js version: 3.4.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

36reactions
aperturelesscommented, Apr 2, 2019

Oh now I understand.

Well. the issue is that the prop is defined as an object in the mixin. And has a default value of an empty object:

https://github.com/apertureless/vue-chartjs/blob/develop/src/mixins/index.js#L89-L92

You are however passing null to it. Because you define

datacollection: null

if you change that to datacollection: {} the warning will go away.

17reactions
williamjingocommented, Jun 27, 2019

Hello, I tried both datacollection:null and datacollection:{}, both never really worked for me. Try datacollection:{ labels:[], datasets: [] }

Read more comments on GitHub >

github_iconTop Results From Across the Web

type check failed for prop "chartData". Expected Object, got ...
This is the error i am getting while running this code. [Vue warn]: Invalid prop: type check failed for prop "chartData". Expected Object ......
Read more >
type check failed for prop chartdata. expected object, got string ...
I have a that throws warning of [Vue warn]: Invalid prop: type check failed for prop "value". Expected Array, File, got String with...
Read more >
3️⃣ 1️⃣ 3️⃣2️⃣3️⃣ on Twitter: "[Vue warn]: Invalid ...
[Vue warn]: Invalid prop: type check failed for prop "chartData" ... Expected Behavior Absence of warning ) Possible answer Can't understand ...
Read more >
[SOLVED] [Vue warn]: Invalid prop: type check failed for prop
It can't update a prop when the value changes. You've also got the argument and modifier the wrong way round, it should be...
Read more >
type check failed for prop "data". Expected Object, got Array
I'm using laravel-vue-pagination getting this error Invalid prop: type check failed for prop "data". Expected Object, got Array code is.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found