Skip to content

Error in console when leaving a page with a chart #115

@DenisD3D

Description

@DenisD3D

Describe the bug
When navigating from a page with a chart to another page, some error appear in the console (see screenshot). Tracking the source seems to be a resize event. Is the chart properly destroy when switching page ?

I'm using Livewire Volt (class based). That means there is no render function and so i'm creating the charts in the with function.

To Reproduce
From a page with a chart, navigate to another page

Expected behavior
No error in the console

Screenshots
Resulting errors in the console
image

Additional context
Minimal Volt component for reproduction:
test.blade.php

<?php

use Livewire\Volt\Component;
use Asantibanez\LivewireCharts\Models\ColumnChartModel;

new class extends Component {

    public function with(): array
    {
        return [
            'columnChartModel' => new ColumnChartModel()
        ];
    }
}; ?>
<div class="text-center">
    <div class="max-w-md m-auto">
        <livewire:livewire-column-chart key="{{ $columnChartModel->reactiveKey() }}" :column-chart-model="$columnChartModel"/>
    </div>
</div>

Solution Ideas
Destroying the chart before leaving the page / unregistering the events

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions