fix: remove livewire:init wrapper from server charts event listeners

The livewire:init event fires before inline scripts execute in Livewire
components, so wrapping Livewire.on() in document.addEventListener('livewire:init')
prevents the callback from ever firing, breaking chart data updates.

This removes the wrapper to match the working pattern in metrics.blade.php.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2026-01-02 13:11:16 +01:00
parent a8aa452475
commit 399b0130bc

View file

@ -109,7 +109,6 @@
const serverCpuChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-cpu`), const serverCpuChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-cpu`),
optionsServerCpu); optionsServerCpu);
serverCpuChart.render(); serverCpuChart.render();
document.addEventListener('livewire:init', () => {
Livewire.on('refreshChartData-{!! $chartId !!}-cpu', (chartData) => { Livewire.on('refreshChartData-{!! $chartId !!}-cpu', (chartData) => {
checkTheme(); checkTheme();
serverCpuChart.updateOptions({ serverCpuChart.updateOptions({
@ -146,7 +145,6 @@
} }
}); });
}); });
});
})(); })();
</script> </script>
@ -247,7 +245,6 @@
const serverMemoryChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-memory`), const serverMemoryChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-memory`),
optionsServerMemory); optionsServerMemory);
serverMemoryChart.render(); serverMemoryChart.render();
document.addEventListener('livewire:init', () => {
Livewire.on('refreshChartData-{!! $chartId !!}-memory', (chartData) => { Livewire.on('refreshChartData-{!! $chartId !!}-memory', (chartData) => {
checkTheme(); checkTheme();
serverMemoryChart.updateOptions({ serverMemoryChart.updateOptions({
@ -285,7 +282,6 @@
} }
}); });
}); });
});
})(); })();
</script> </script>