From fbe87f8e0091adcddd9ec195d0ae6d7829be3c3c Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Sun, 13 Feb 2022 19:26:59 -0600 Subject: Reverted change in commands view --- iosApp/iosApp/Details/Commands/UnitCommandsView.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift index b60b1cf..eef3ae4 100644 --- a/iosApp/iosApp/Details/Commands/UnitCommandsView.swift +++ b/iosApp/iosApp/Details/Commands/UnitCommandsView.swift @@ -21,7 +21,12 @@ import shared struct UnitCommandsView: View { @ObservedObject var unitCommandsViewModel = UnitCommandsViewModel() - let unit: UnitInformation + var unit: UnitInformation + + init(unit: UnitInformation) { + self.unit = unit + unitCommandsViewModel.fetchCommands(id: unit.device.id) + } var body: some View { VStack { @@ -49,8 +54,5 @@ struct UnitCommandsView: View { } } } - .onAppear { - unitCommandsViewModel.fetchCommands(id: unit.device.id) - } } } -- cgit v1.2.3