fix browser not updating live

This commit is contained in:
Adam 2024-08-29 21:44:39 -04:00
parent d54d53bb09
commit 54fa246229

View file

@ -59,20 +59,21 @@ pub fn Browser() -> impl IntoView {
<th class="border-b"></th>
</tr>
</thead>
<For
each=move || game_browser_context()
key=|game| game.uuid.clone()
children=move |game| {
// This rebuilds the entire browser each time it runs but using <For /> won't update the children if the id doesn't change
{game_browser_context()
.iter()
.cloned()
.map(|game| {
view! {
{
logging::log!("I ran");
}
<tr>
<td class="text-center border-b">{&game.name}</td>
<td class="text-center border-b">{&game.host}</td>
<td class="text-center border-b">
{&game.players.to_string()}
</td>
<td class="text-center border-b">
{&game.packs.len().to_string()}
</td>
<td class="text-center border-b">{game.name}</td>
<td class="text-center border-b">{game.host}</td>
<td class="text-center border-b">{game.players}</td>
<td class="text-center border-b">{game.packs.len()}</td>
<td class="text-center border-b">
<button
type="button"
@ -95,8 +96,8 @@ pub fn Browser() -> impl IntoView {
</td>
</tr>
}
}
/>
})
.collect_view()}
</table>
</div>
</Show>