Skip to content

Commit

Permalink
fix: first round not showing when starting meal recording
Browse files Browse the repository at this point in the history
  • Loading branch information
tmlmt authored Jun 13, 2024
1 parent 4368781 commit bcb8b49
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions milk_tracker/pages/root.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pathlib import Path
from typing import Any, Dict, List, Literal
from typing import Any, Dict, List, Literal, Optional

from controllers.app import AppController
from nicegui import ui
Expand Down Expand Up @@ -252,7 +252,9 @@ def handle_meal_round_action() -> None:
generate_meal_round_list.refresh()

@ui.refreshable
def generate_meal_round_list() -> ui.list:
def generate_meal_round_list() -> Optional[ui.list]:
if not mt.computed.is_ongoing_meal:
return None
with ui.list().props("bordered dense") as meal_round_list:
for round_number, round_details in enumerate(mt.ongoing_meal.rounds): # type: ignore[union-attr]
with ui.item().props(
Expand Down Expand Up @@ -293,9 +295,8 @@ def generate_meal_round_list() -> ui.list:
ui.button(on_click=handle_meal_round_action).bind_text_from(
mt.computed, "is_ongoing_meal_buttontxt"
).bind_enabled_from(mt.computed, "is_ongoing_meal")
if mt.computed.is_ongoing_meal:
with ui.element() as meal_rounds_container:
generate_meal_round_list()
with ui.element() as meal_rounds_container:
generate_meal_round_list()

ui.markdown("## 10 last meals")

Expand Down

0 comments on commit bcb8b49

Please # to comment.