Fix color highlighting not applying on initial runtime logs load

Added morph.added hook to apply color highlighting when logs are first
loaded. The morph.updated hook only fires on subsequent updates, not
on initial DOM insertion.

🤖 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 2025-12-18 12:43:42 +01:00
parent 8a4303cc02
commit 334fd2500f

View File

@ -192,16 +192,28 @@
this.applySearch();
});
// Apply colors after Livewire updates
// Handler for applying colors and search after DOM changes
const applyAfterUpdate = () => {
this.$nextTick(() => {
this.applyColorLogs();
this.applySearch();
if (this.alwaysScroll) {
this.scrollToBottom();
}
});
};
// Apply colors after Livewire updates (existing content)
Livewire.hook('morph.updated', ({ el }) => {
if (el.id === 'logs') {
this.$nextTick(() => {
this.applyColorLogs();
this.applySearch();
if (this.alwaysScroll) {
this.scrollToBottom();
}
});
applyAfterUpdate();
}
});
// Apply colors after Livewire adds new content (initial load)
Livewire.hook('morph.added', ({ el }) => {
if (el.id === 'logs') {
applyAfterUpdate();
}
});
}