You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a Chart in a DataTable leads to the following error, if the array given to the DataTable as value contains exactly one element:
Failed to create chart: can't acquire context from the given item
And the following error with more than one element:
Uncaught (in promise) TypeError: existingChart.canvas is null
The problem is possibly related to the fact, that the Chart is mounted twice in quick succession.
The beforeUnmount of the Chart is called before the initChart function in the mounted is finished. Therefore, this.chart is still null and not destroyed.
The second call to mounted fails, because this.chart is not null at this point and was also not destroyed by the beforeUnmounted call.
The DataTable is in App.vue, the Chart is in TestComponent.vue.
The Bar Chart in TestComponent.vue is a simplified version of: https://primevue.org/chart/#basic
Expected behavior
No errors.
The text was updated successfully, but these errors were encountered:
Describe the bug
Using a Chart in a DataTable leads to the following error, if the array given to the DataTable as value contains exactly one element:
And the following error with more than one element:
The problem is possibly related to the fact, that the Chart is mounted twice in quick succession.
The
beforeUnmount
of the Chart is called before theinitChart
function in themounted
is finished. Therefore,this.chart
is still null and not destroyed.The second call to
mounted
fails, becausethis.chart
is not null at this point and was also not destroyed by thebeforeUnmounted
call.Reproducer
https://stackblitz.com/edit/vitejs-vite-dvqqne?file=src%2FApp.vue
PrimeVue version
3.52.0
Vue version
3.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
Example: https://stackblitz.com/edit/vitejs-vite-dvqqne?file=src%2FApp.vue
The DataTable is in
App.vue
, the Chart is inTestComponent.vue
.The Bar Chart in
TestComponent.vue
is a simplified version of: https://primevue.org/chart/#basicExpected behavior
No errors.
The text was updated successfully, but these errors were encountered: