DataTable and Chart: DataTable mounting components twice, leading to problems with Chart #5743
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
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: