From 1ae122dfd7f900f0af58efb3f1268178a80e9e7b Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Sat, 19 Sep 2026 12:07:55 +0200 Subject: [PATCH] =?UTF-8?q?chore(desktop):=20satisfy=20eslint=20=E2=80=94?= =?UTF-8?q?=20lazy=20OS=20detect=20+=20if-block=20in=20AddDrive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- desktop/ui/src/hooks/useIsWindows10.ts | 13 +++++-------- desktop/ui/src/pages/AddDrive.tsx | 4 +++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/desktop/ui/src/hooks/useIsWindows10.ts b/desktop/ui/src/hooks/useIsWindows10.ts index 9c0c57ec..07c1e3a7 100644 --- a/desktop/ui/src/hooks/useIsWindows10.ts +++ b/desktop/ui/src/hooks/useIsWindows10.ts @@ -1,4 +1,4 @@ -import { useState, useEffect } from "react"; +import { useState } from "react"; import { version } from "@tauri-apps/plugin-os"; /** @@ -7,20 +7,17 @@ import { version } from "@tauri-apps/plugin-os"; * Windows 11 also reports as "10.0" but with build number >= 22000. */ export function useIsWindows10(): boolean | null { - const [isWindows10, setIsWindows10] = useState(null); - - useEffect(() => { + const [isWindows10] = useState(() => { // Windows version format: "10.0.19045" (Win10) or "10.0.22631" (Win11) // Windows 11 has build number >= 22000 const parts = version().split("."); if (parts.length >= 3) { const buildNumber = parseInt(parts[2], 10); // Windows 10 has build numbers below 22000 - setIsWindows10(!isNaN(buildNumber) && buildNumber < 22000); - } else { - setIsWindows10(false); + return !isNaN(buildNumber) && buildNumber < 22000; } - }, []); + return false; + }); return isWindows10; } diff --git a/desktop/ui/src/pages/AddDrive.tsx b/desktop/ui/src/pages/AddDrive.tsx index 8543d284..be8aa57f 100644 --- a/desktop/ui/src/pages/AddDrive.tsx +++ b/desktop/ui/src/pages/AddDrive.tsx @@ -129,7 +129,9 @@ export default function AddDrive({ mode = "add" }: AddDriveProps) { pkceSessionRef.current.callbackData = callbackData; // Transition to final setup page - callbackData.name && setDriveName(callbackData.name); + if (callbackData.name) { + setDriveName(callbackData.name); + } setPageState("final_setup"); }).then((fn) => { unlisten = fn;