Skip to content

Commit fe9b928

Browse files
committed
theme: Fix Alpine broken by Turbo v8.0.21
Turbo v8.0.21 changed same-page anchor handling to let the browser manage them directly, but this causes turbo:before-cache to fire without a corresponding turbo:render event. This stopped Alpine's mutation observer without restarting it, breaking all Alpine interactivity (TOC, search, navbar). Remove Alpine.stopObservingMutations() from turbo:before-cache since it now fires on same-page anchor clicks. Closes gohugoio#3361
1 parent 9206cb6 commit fe9b928

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

assets/js/helpers/bridgeTurboAndAlpine.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export function bridgeTurboAndAlpine(Alpine) {
3030

3131
// Cleanup Alpine state on navigation.
3232
document.addEventListener('turbo:before-cache', () => {
33-
// This will be restarted in turbo:render.
34-
Alpine.stopObservingMutations();
35-
3633
document.body.querySelectorAll('[data-turbo-permanent]').forEach((el) => {
3734
if (!el.hasAttribute('x-ignore')) {
3835
el.setAttribute('x-ignore', true);

0 commit comments

Comments
 (0)