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) {