From c2eb088bb2109ec3d93f60073c1d02ddca637f01 Mon Sep 17 00:00:00 2001 From: bruno Date: Sun, 19 Jul 2026 14:45:06 -0400 Subject: [PATCH] fix(library): splice au lieu d'assignation pour Alpine 3.14.9 x-for MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alpine 3.14.9 ne détecte pas le changement de référence d'array (this.flatItems = result). Utilisation de splice() pour muter l'array en place. Ajout de $nextTick pour forcer le re-render. --- app/templates/library.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/templates/library.html b/app/templates/library.html index d46612f..ad7fcfd 100644 --- a/app/templates/library.html +++ b/app/templates/library.html @@ -379,7 +379,8 @@ function libraryPage() { return (r.title || '').toLowerCase().indexOf(q) !== -1; }); } - this.flatItems = result; + // Use splice for Alpine 3.14.9 reactivity (array reference reassign fails) + this.flatItems.splice(0, this.flatItems.length, ...result); this.selectedCount = Object.keys(this.selected).length; this.allSelected = this.flatItems.length > 0 && this.selectedCount === this.flatItems.length; }, @@ -483,11 +484,14 @@ function libraryPage() { this._markTree(this.items, 0); this._recomputeFlatItems(); console.log('[Library] flatItems after recompute: ' + this.flatItems.length); + // Force Alpine to re-render (known issue with x-for in 3.14.9) + var self = this; + this.$nextTick(function() { self.loading = false; }); } catch(e) { console.error('[Library] load error:', e); this.items = []; + this.loading = false; } - this.loading = false; }, _markTree(nodes, depth) {