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