mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-16 08:15:00 +00:00
fix(deployment): unregister Livewire morph hook on teardown
Store the morph.updated cleanup callback and invoke it during Alpine destroy so deployment log search hooks do not survive component teardown.
This commit is contained in:
1 parent
7f35a2d98e
commit
0c6a233b27
2 files changed
+12
-4
No files matched your search
@@ -13,6 +13,7 @@
|
||||
scrollDebounce: null,
|
||||
isScrolling: false,
|
||||
destroyed: false,
|
||||
morphUpdatedCleanup: null,
|
||||
deploymentFinishedCleanup: null,
|
||||
lastTouchY: 0,
|
||||
showTimestamps: true,
|
||||
@@ -212,10 +213,8 @@
|
||||
});
|
||||
|
||||
// Apply search after Livewire updates.
|
||||
// Livewire.hook() has no deregister API, so this callback survives
|
||||
// wire:navigate. It is made harmless after teardown by the
|
||||
// `destroyed` guard and by only reacting to DOM inside this root.
|
||||
Livewire.hook('morph.updated', ({ el }) => {
|
||||
// Livewire.hook() returns an unregister fn; keep it for destroy().
|
||||
this.morphUpdatedCleanup = Livewire.hook('morph.updated', ({ el }) => {
|
||||
if (this.destroyed) return;
|
||||
if (el.id !== 'logs' || !this.$root.contains(el)) return;
|
||||
this.$nextTick(() => {
|
||||
@@ -251,6 +250,10 @@
|
||||
clearTimeout(this.scrollDebounce);
|
||||
this.scrollDebounce = null;
|
||||
}
|
||||
if (typeof this.morphUpdatedCleanup === 'function') {
|
||||
this.morphUpdatedCleanup();
|
||||
this.morphUpdatedCleanup = null;
|
||||
}
|
||||
if (typeof this.deploymentFinishedCleanup === 'function') {
|
||||
this.deploymentFinishedCleanup();
|
||||
this.deploymentFinishedCleanup = null;
|
||||
|
||||
Reference in new issue
Block a user