fix(navigation): remove stale cloak after Livewire navigation (#10518)

This commit is contained in:
Andras Bacsai authored and GitHub committed 2026-06-02 17:13:59 +02:00
commit 6c3ea7f1db
2 files changed
+24

No files matched your search

+8
View File
@@ -1,5 +1,13 @@
import { initializeTerminalComponent } from './terminal.js';
// Livewire 3.5.19+ re-applies `x-cloak` to morphed elements during wire:navigate
// (via replaceHtmlAttributes). With `[x-cloak]{display:none}` on the app wrapper,
// this blanks the whole page on every navigation until Alpine re-processes it.
// Strip leftover x-cloak after each navigation; the initial-load FOUC guard stays.
document.addEventListener('livewire:navigated', () => {
document.querySelectorAll('[x-cloak]').forEach((el) => el.removeAttribute('x-cloak'));
});
['livewire:navigated', 'alpine:init'].forEach((event) => {
document.addEventListener(event, () => {
// tree-shaking