[Vue warn]: Invalid prop: type check failed for prop "chartData"
See original GitHub issueExpected 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:
- Created 4 years ago
- Reactions:5
- Comments:12 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.Hello, I tried both
datacollection:null
anddatacollection:{}
, both never really worked for me. Trydatacollection:{ labels:[], datasets: [] }