feat(ota): set updating immediately

This commit is contained in:
Adam Shiervani 2025-11-18 16:28:45 +01:00
parent 5f76e30e55
commit 8113cd40ad
2 changed files with 13 additions and 8 deletions

View File

@ -190,6 +190,9 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error {
return fmt.Errorf("update already in progress") return fmt.Errorf("update already in progress")
} }
s.updating = true
s.triggerStateUpdate()
if len(params.Components) == 0 { if len(params.Components) == 0 {
params.Components = defaultComponents params.Components = defaultComponents
} }
@ -198,7 +201,11 @@ func (s *State) doUpdate(ctx context.Context, params UpdateParams) error {
_, shouldUpdateSystem := params.Components["system"] _, shouldUpdateSystem := params.Components["system"]
if !shouldUpdateApp && !shouldUpdateSystem { if !shouldUpdateApp && !shouldUpdateSystem {
return fmt.Errorf("no components to update") return s.componentUpdateError(
"Update aborted: no components were specified to update. Requested components: ",
fmt.Errorf("%v", params.Components),
&scopedLogger,
)
} }
appUpdate, systemUpdate, err := s.getUpdateStatus(ctx, params) appUpdate, systemUpdate, err := s.getUpdateStatus(ctx, params)

View File

@ -47,17 +47,15 @@ export default function SettingsGeneralUpdateRoute() {
if (appTargetVersion) components.app = appTargetVersion; if (appTargetVersion) components.app = appTargetVersion;
if (systemTargetVersion) components.system = systemTargetVersion; if (systemTargetVersion) components.system = systemTargetVersion;
setShouldReload(true);
setModalView("updating");
send("tryUpdateComponents", { send("tryUpdateComponents", {
params: { params: { components, },
components,
},
includePreRelease: false, includePreRelease: false,
resetConfig, resetConfig,
}, (resp) => {
if ("error" in resp) return;
setModalView("updating");
}); });
}, [send, setModalView, resetConfig]); }, [resetConfig, send, setModalView, setShouldReload]);
useEffect(() => { useEffect(() => {
if (otaState.updating) { if (otaState.updating) {