kixelated
kixelated
SSolidJS
Created by kixelated on 6/28/2023 in #support
Resource from async generator?
so solid uses === and decides nothing has changed, so no need to render
7 replies
SSolidJS
Created by kixelated on 6/28/2023 in #support
Resource from async generator?
so the array returned by the generator was not actually returning new values, but rather the same value at a new point in time
7 replies
SSolidJS
Created by kixelated on 6/28/2023 in #support
Resource from async generator?
so the problem was that new broadcasts were being pushed to the array and returned as part of the generator
7 replies
SSolidJS
Created by kixelated on 6/28/2023 in #support
Resource from async generator?
okay, I figured it out
7 replies
SSolidJS
Created by kixelated on 6/28/2023 in #support
Resource from async generator?
return (
<>
<p class="mb-6 text-center font-mono text-xl">Watch</p>
<ul>
<For each={broadcasts()} fallback={<li>No live broadcasts</li>}>
{(broadcast) => {
return (
<li class="mb-4">
<a>{broadcast}</a>
</li>
)
}}
</For>
</ul>
</>
)
return (
<>
<p class="mb-6 text-center font-mono text-xl">Watch</p>
<ul>
<For each={broadcasts()} fallback={<li>No live broadcasts</li>}>
{(broadcast) => {
return (
<li class="mb-4">
<a>{broadcast}</a>
</li>
)
}}
</For>
</ul>
</>
)
7 replies
SSolidJS
Created by kixelated on 6/28/2023 in #support
Resource from async generator?
I think the misunderstanding is somewhere else, because even a simple Signal is not reactive:
const [broadcasts, setBroadcasts] = createSignal<Array<string>>([])

createEffect(async () => {
for await (const broadcasts of props.player.broadcasts()) {
console.log("got broadcasts", broadcasts)
setBroadcasts(broadcasts)
}
})
const [broadcasts, setBroadcasts] = createSignal<Array<string>>([])

createEffect(async () => {
for await (const broadcasts of props.player.broadcasts()) {
console.log("got broadcasts", broadcasts)
setBroadcasts(broadcasts)
}
})
7 replies