Skip to content

Commit

Permalink
fix: set grid_layout only once when the component is mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
adagora committed Nov 28, 2023
1 parent 1b51f4c commit e5c1829
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions solarathon/pages/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ def fetch_data(should_stop: Event):
).key(symbol)
dashboard_cards.append(card)

grid_layout_dyn = [
solara.use_memo(lambda: set_grid_layout([
{"h": 6, "i": str(i), "moved": False, "w": row_widths[i % len(row_widths)], "x": sum(row_widths[:i % len(row_widths)]), "y": (i // len(row_widths)) * 6}
for i in range(len(init_app_state.value))
]
]),[dashboard_cards])

len(dashboard_cards)<= 0 and solara.Error("No data available")
solara.GridDraggable(items=dashboard_cards, grid_layout=grid_layout_dyn, resizable=True, draggable=True, on_grid_layout=set_grid_layout)
solara.GridDraggable(items=dashboard_cards, grid_layout=grid_layout, resizable=True, draggable=True, on_grid_layout=set_grid_layout)

return main

Expand Down

0 comments on commit e5c1829

Please sign in to comment.