From 1c73f1e320a9010a81c2e6250bcc1da308a0b2c7 Mon Sep 17 00:00:00 2001 From: Jure <44338+hoornet@users.noreply.github.com> Date: Fri, 22 May 2026 14:59:57 +0200 Subject: [PATCH] fix: harden updater null-handling, dev-mock install_info, honest interests copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - useUpdater: guard the install_info response — a null/garbage value no longer overwrites the optimistic default and crash the whole app on installInfo.can_self_update. (Real app never returns null here; this is defensive — a failed updater check must not take down Vega.) - tauri-dev-mock: add an install_info case so browser dev mode (localhost:1420) doesn't crash on the post-onboarding render. - onboarding: the interests step claimed "you can always change this later" — there is no interests editor anywhere. Copy is now honest about what interests do (surface as hashtag pills on an empty Following feed). --- src/components/onboarding/OnboardingFlow.tsx | 2 +- src/hooks/useUpdater.ts | 4 +++- src/lib/tauri-dev-mock.ts | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/onboarding/OnboardingFlow.tsx b/src/components/onboarding/OnboardingFlow.tsx index 6f01796..d1b0837 100644 --- a/src/components/onboarding/OnboardingFlow.tsx +++ b/src/components/onboarding/OnboardingFlow.tsx @@ -97,7 +97,7 @@ function InterestsStep({ onComplete }: { onComplete: () => void }) { return ( What are you into? - Pick a few topics to get your feed started. You can always change this later. + Pick a few topics — we'll suggest them as hashtags to explore.
{INTEREST_TOPICS.map(({ emoji, label, tag }) => { diff --git a/src/hooks/useUpdater.ts b/src/hooks/useUpdater.ts index 80f7943..fbfe513 100644 --- a/src/hooks/useUpdater.ts +++ b/src/hooks/useUpdater.ts @@ -32,7 +32,9 @@ export function useUpdater(): UpdateState { useEffect(() => { invoke("install_info") - .then(setInstallInfo) + // Guard: a null/garbage response must not blow away the optimistic + // default — installInfo is dereferenced unconditionally in the return. + .then((info) => { if (info) setInstallInfo(info); }) .catch(() => { /* keep optimistic default */ }); }, []); diff --git a/src/lib/tauri-dev-mock.ts b/src/lib/tauri-dev-mock.ts index 6ffa05c..0fb0b70 100644 --- a/src/lib/tauri-dev-mock.ts +++ b/src/lib/tauri-dev-mock.ts @@ -29,6 +29,9 @@ if (import.meta.env.DEV && !(window as any).__TAURI_INTERNALS__) { return []; case "db_load_profile": return null; + case "install_info": + // Browser dev mode has no real install — mirror useUpdater's default. + return { can_self_update: true, kind: "updater" }; default: console.warn("[tauri-dev-mock] unhandled invoke:", cmd, args); return null;