Basically trying to modify the dynamic search bar that can be found in Alpine docs, but with "items" ("bands" in my case) coming from x-init that fetches a JSON. Outside of this search bar all the desired data from this JSON is displayed so it's not like the JSON itself is empty, but in this particular situation x-text doesn't even list any of the values, as if the JSON data never gets to the x-data/"bands" array.
This is what I currently have, like I said it's a little modification of the search bar from the docs.
<div x-data="{
search: '',
bands: [],
get filteredItems() {
return this.bands.filter(
i => i.startsWith(this.search)
)
}
}" x-init="bands = await (await fetch('/bands/')).json()">
<input x-model="search" placeholder="Search...">
<template x-for="band in filteredItems" :key="band">
<p x-text="`${band.name}`"></p>
</template>
</div>
I'd be grateful if anyone told me what exactly this seemingly straightforward chunk of code is missing.