From 6e1b84f39b9de3f410a9d6ecf1dd43ed635dcbbb Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Fri, 7 Nov 2025 06:21:38 -0600 Subject: [PATCH 1/2] chore: clean up logger messaging --- web.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web.go b/web.go index bef5a741..667dee1c 100644 --- a/web.go +++ b/web.go @@ -814,7 +814,7 @@ func handleSendWOLMagicPacket(c *gin.Context) { inputMacAddr := c.Param("mac-addr") macAddr, err := net.ParseMAC(inputMacAddr) if err != nil { - logger.Warn().Err(err).Str("sendWol", inputMacAddr).Msg("Invalid mac address provided") + logger.Warn().Err(err).Str("inputMacAddr", inputMacAddr).Msg("Invalid MAC address provided") c.String(http.StatusBadRequest, "Invalid mac address provided") return } @@ -822,7 +822,7 @@ func handleSendWOLMagicPacket(c *gin.Context) { macAddrString := macAddr.String() err = rpcSendWOLMagicPacket(macAddrString) if err != nil { - logger.Warn().Err(err).Str("sendWOL", macAddrString).Msg("Failed to send WOL magic packet") + logger.Warn().Err(err).Str("macAddrString", macAddrString).Msg("Failed to send WOL magic packet") c.String(http.StatusInternalServerError, "Failed to send WOL to %s: %v", macAddrString, err) return } From 7f2dcc84b440c74ba4900b271ab5ecde93589157 Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Mon, 10 Nov 2025 05:58:57 -0600 Subject: [PATCH 2/2] fix: don't reload page if we didn't attempt an upgrade. (#955) --- ui/src/hooks/stores.ts | 18 ++++++++++++------ .../devices.$id.settings.general.update.tsx | 17 +++++++++++------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ui/src/hooks/stores.ts b/ui/src/hooks/stores.ts index c56cb5f8..0be28425 100644 --- a/ui/src/hooks/stores.ts +++ b/ui/src/hooks/stores.ts @@ -603,6 +603,9 @@ export interface UpdateState { updateErrorMessage: string | null; setUpdateErrorMessage: (errorMessage: string) => void; + + shouldReload: boolean; + setShouldReload: (reloadRequired: boolean) => void; } export const useUpdateStore = create(set => ({ @@ -640,6 +643,9 @@ export const useUpdateStore = create(set => ({ updateErrorMessage: null, setUpdateErrorMessage: (errorMessage: string) => set({ updateErrorMessage: errorMessage }), + + shouldReload: false, + setShouldReload: (reloadRequired: boolean) => set({ shouldReload: reloadRequired }), })); export type UsbConfigModalViews = "updateUsbConfig" | "updateUsbConfigSuccess"; @@ -850,12 +856,12 @@ export interface MacrosState { loadMacros: () => Promise; saveMacros: (macros: KeySequence[]) => Promise; sendFn: - | (( - method: string, - params: unknown, - callback?: ((resp: JsonRpcResponse) => void) | undefined, - ) => void) - | null; + | (( + method: string, + params: unknown, + callback?: ((resp: JsonRpcResponse) => void) | undefined, + ) => void) + | null; setSendFn: ( sendFn: ( method: string, diff --git a/ui/src/routes/devices.$id.settings.general.update.tsx b/ui/src/routes/devices.$id.settings.general.update.tsx index 285ce940..dd800011 100644 --- a/ui/src/routes/devices.$id.settings.general.update.tsx +++ b/ui/src/routes/devices.$id.settings.general.update.tsx @@ -18,20 +18,24 @@ export default function SettingsGeneralUpdateRoute() { const location = useLocation(); const { updateSuccess } = location.state || {}; - const { setModalView, otaState } = useUpdateStore(); + const { setModalView, otaState, shouldReload, setShouldReload } = useUpdateStore(); const { send } = useJsonRpc(); const onClose = useCallback(async () => { navigate(".."); // back to the devices.$id.settings page - // Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation. - await sleep(1000); - window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded - }, [navigate]); + + if (shouldReload) { + setShouldReload(false); + await sleep(1000); // Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation. + window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded + } + }, [navigate, setShouldReload, shouldReload]); const onConfirmUpdate = useCallback(() => { + setShouldReload(true); send("tryUpdate", {}); setModalView("updating"); - }, [send, setModalView]); + }, [send, setModalView, setShouldReload]); useEffect(() => { if (otaState.updating) { @@ -133,6 +137,7 @@ function LoadingState({ const { setModalView } = useUpdateStore(); const progressBarRef = useRef(null); + useEffect(() => { abortControllerRef.current = new AbortController(); const signal = abortControllerRef.current.signal;