Skip to content

Open-source Xbox-inspired desktop launcher for Xodus on Linux

TypeScript

feat(settings): present component update plans and partial results

domsvobodaa70bd4e16ff5
diff --git a/assets/locales/en.json b/assets/locales/en.json
index e9e1820..2f444cc 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -1,4 +1,22 @@
{
+ "updates.title": "Component updates",
+ "updates.help": "Update installed managed components together. Optional runtimes are not installed automatically. Game family choices, prefixes and local saves are kept.",
+ "updates.action": "Update all components",
+ "updates.confirm_title": "Update installed components?",
+ "updates.confirm_help": "Only the listed installed components will be updated. The launcher is updated last and will not restart automatically.",
+ "updates.apply": "Apply updates",
+ "updates.results": "Component update results",
+ "updates.ready": "Ready to update",
+ "updates.updated": "Updated",
+ "updates.unchanged": "Up to date",
+ "updates.skipped": "Skipped",
+ "updates.stale": "Changed since checking, check again",
+ "updates.committed_attention": "Activated, needs attention",
+ "updates.failed": "Failed before activation",
+ "updates.not_run": "Not run",
+ "updates.deferred": "Deferred",
+ "updates.retry": "Retry {{name}}",
+ "updates.restart_help": "Restart the launcher using Restart launcher below when you are ready. No restart happens automatically.",
"runtime.default_title": "Default Wine / Proton runtime",
"runtime.families_current": "This family is up to date.",
"runtime.families_title": "Per-game runtime families",
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index 10a543c..3b2e079 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -1,3 +1,4 @@
+import {ComponentUpdates} from './ComponentUpdates';
import {ManagedRuntimeSettings} from './ManagedRuntimeSettings';
import {useGameRuntimeReady} from './useGameRuntimeReady';
import {useStoreAccess} from './store-access';
@@ -996,6 +997,8 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value
<CheckField className="tray-toggle" role="switch" label={ui('settings.close_to_tray')} description={ui('settings.close_to_tray_help')} checked={form.closeToTray===true} disabled={Boolean(busy)} onChange={event=>{const closeToTray=event.target.checked;setForm({...form,closeToTray});void invoke('close-to-tray',()=>window.launcher.updateSettings({closeToTray}),ui('settings.tray_saved'));}}/>
</section>
+ <ComponentUpdates data={data} disabled={Boolean(busy)||data.auth.running||data.backend.updating||data.runtime.updating||Boolean(data.launcherUpdate?.updating)||Boolean(data.gameOperation&&['preparing','running','stopping'].includes(data.gameOperation.status))||data.downloads.some(task=>['queued','running','paused'].includes(task.status))} onBusyChange={value=>setBusy(value?'component-updates':undefined)}/>
+
<section className="settings-card compact launcher-card">
{data.launcherUpdate?.phase ? <p>{uiText(data.launcherUpdate.phase)}</p> : null}
{data.launcherUpdate?.updating ? <div className="progress-track"><i style={{ width: `${data.launcherUpdate.progress ?? 0}%` }} /></div> : null}
@@ -1004,7 +1007,7 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value
<div className="button-row">
{data.launcherUpdate?.latestVersion && data.launcherUpdate.canInstall && !data.launcherUpdate.restartRequired ? <button className="primary" disabled={data.launcherUpdate.updating || Boolean(busy)} onClick={async () => { if (await confirm({ title: ui("ui.install_launcher_update_15498d2"), message: ui("ui.the_current_appimage_will_be_backed_up_games_and_8e8c5e5"), confirmLabel: ui("ui.install_update_cada421") })) void invoke('launcher-install', () => window.launcher.installLauncherUpdate()); }}><ArrowDownToLine />{data.launcherUpdate.updating ? ui("ui.updating_dfe40ef") : ui("ui.install_launcher_update_d1988d9")}</button> : null}
{data.launcherUpdate?.releaseUrl && !data.launcherUpdate.canInstall ? <a className="primary" href={data.launcherUpdate.releaseUrl} target="_blank" rel="noreferrer"><ArrowDownToLine />{ui("ui.download_update_4f494b2")}</a> : null}
- {data.launcherUpdate?.restartRequired ? <button className="primary" onClick={() => invoke('launcher-restart', () => window.launcher.restartLauncher())}><RefreshCw />{ui("ui.restart_launcher_b076da9")}</button> : null}
+ {data.launcherUpdate?.restartRequired ? <button className="primary" disabled={Boolean(busy)||data.componentUpdates?.running} onClick={() => invoke('launcher-restart', () => window.launcher.restartLauncher())}><RefreshCw />{ui("ui.restart_launcher_b076da9")}</button> : null}
{data.launcherUpdate?.canRollback ? <button className="secondary" disabled={data.launcherUpdate.updating || Boolean(busy)} onClick={async () => { if (await confirm({ title: ui("ui.restore_previous_launcher_ab5c227"), message: ui("ui.your_settings_and_games_will_not_change_3e99619"), confirmLabel: ui("ui.restore_launcher_a0520ac") })) void invoke('launcher-rollback', () => window.launcher.rollbackLauncherUpdate()); }}>{ui("ui.restore_previous_launcher_9b5f101")}</button> : null}
<button className="secondary" disabled={data.launcherUpdate?.checking || data.launcherUpdate?.updating || data.launcherUpdate?.restartRequired} onClick={() => invoke('update-check', () => window.launcher.checkLauncherUpdate(), ui("ui.update_check_finished_3f30d8a"))}>{data.launcherUpdate?.checking ? <LoaderCircle className="spin" /> : <RefreshCw />}{ui("ui.check_for_updates_f26f327")}</button>
<button className="secondary" disabled={Boolean(busy)} title={ui("ui.add_nexus_with_artwork_including_while_steam_is_f7d03b8")} onClick={() => invoke('steam-launcher', () => window.launcher.addToSteam(), ui("ui.nexus_added_to_steam_2f6a699"))}><Plus />{ui("ui.add_nexus_to_steam_790c35e")}</button>
@@ -1060,7 +1063,7 @@ export function SettingsPage({ data, toast }: { data: AppSnapshot; toast: (value
{data.runtime.updating || runtimeLogs.length > 0 ? <pre className="build-log">{runtimeLogs.join('\n') || ui("ui.waiting_for_output_f05fefe")}</pre> : null}
</section>
- <ManagedRuntimeSettings data={data} disabled={Boolean(busy)||data.auth.running||data.backend.updating||data.runtime.updating||Boolean(data.launcherUpdate?.updating)||Boolean(data.gameOperation&&['preparing','running','stopping'].includes(data.gameOperation.status))||data.downloads.some(task=>['queued','running','paused'].includes(task.status))} onBusyChange={value=>setBusy(value?'managed-runtime':undefined)}/>
+ <ManagedRuntimeSettings data={data} disabled={Boolean(busy)||data.componentUpdates?.running===true||data.auth.running||data.backend.updating||data.runtime.updating||Boolean(data.launcherUpdate?.updating)||Boolean(data.gameOperation&&['preparing','running','stopping'].includes(data.gameOperation.status))||data.downloads.some(task=>['queued','running','paused'].includes(task.status))} onBusyChange={value=>setBusy(value?'managed-runtime':undefined)}/>
<div className="settings-storage">
<section className="settings-card compact">
diff --git a/src/renderer/ComponentUpdates.tsx b/src/renderer/ComponentUpdates.tsx
new file mode 100644
index 0000000..d71de19
--- /dev/null
+++ b/src/renderer/ComponentUpdates.tsx
@@ -0,0 +1,73 @@
+import {useEffect,useRef,useState} from 'react';
+import {RefreshCw,LoaderCircle} from 'lucide-react';
+import type {AppSnapshot,ComponentUpdatePlan,ComponentUpdateBatchResult,ComponentUpdateOutcome} from '../shared/types';
+import {useConfirmation} from './Confirmation';
+import {ui} from './i18n';
+function outcomeLabel(value:ComponentUpdateOutcome):string {
+ switch(value){
+ case 'updated':return ui('updates.updated');case 'unchanged':return ui('updates.unchanged');
+ case 'skipped':return ui('updates.skipped');case 'stale':return ui('updates.stale');
+ case 'committed-needs-attention':return ui('updates.committed_attention');
+ case 'failed-before-commit':return ui('updates.failed');case 'not-run':return ui('updates.not_run');case 'deferred':return ui('updates.deferred');
+ }
+}
+export function ComponentUpdates({data,disabled,onBusyChange}:{data:AppSnapshot;disabled:boolean;onBusyChange:(busy:boolean)=>void}) {
+ const confirm=useConfirmation();
+ const [local,setLocal]=useState<{scope:string;plan:ComponentUpdatePlan;result?:ComponentUpdateBatchResult}>();
+ const [pending,setPending]=useState(false),[error,setError]=useState<{scope:string;text:string}>();
+ // Component identities change during a successful batch. Main owns exact identity checks.
+ const scope=JSON.stringify([data.settings.runtimeRoot,data.settings.market,data.auth.username,data.auth.player,data.auth.stored]);
+ const live=useRef(scope),mounted=useRef(true),inFlight=useRef(false);live.current=scope;
+ useEffect(()=>{mounted.current=true;return()=>{mounted.current=false;};},[]);
+ const status=data.componentUpdates,signature=JSON.stringify(status);
+ const planScopes=useRef(new Map<string,string>());
+ if(status?.plan&&!planScopes.current.has(status.plan.id))planScopes.current.set(status.plan.id,scope);
+ while(planScopes.current.size>16)planScopes.current.delete(planScopes.current.keys().next().value!);
+ const visibleStatus=status?.plan&&planScopes.current.get(status.plan.id)===scope?status:undefined;
+ useEffect(()=>setLocal(undefined),[scope,signature]);
+ const plan=local?.scope===scope?local.plan:visibleStatus?.plan;
+ const result=local?.scope===scope?local.result:visibleStatus?.result;
+ const applicable=result&&result.planId===plan?.id?result:undefined;
+ const running=pending||status?.running===true;
+ const apiReady=typeof window!=='undefined'&&typeof window.launcher?.planComponentUpdates==='function'&&typeof window.launcher?.applyComponentUpdates==='function'&&typeof window.launcher?.retryComponentUpdate==='function';
+ async function perform(retryId?:string) {
+ if(disabled||running||inFlight.current||!apiReady)return;
+ const captured=scope;inFlight.current=true;setPending(true);setError(undefined);onBusyChange(true);
+ try {
+ if(retryId){
+ if(!plan||!applicable?.items.some(item=>item.id===retryId&&item.retryable))return;
+ const next=await window.launcher.retryComponentUpdate(plan.id,retryId);
+ if(mounted.current&&live.current===captured)setLocal({scope:captured,plan,result:next});
+ }else{
+ const next=await window.launcher.planComponentUpdates();
+ if(!mounted.current||live.current!==captured)return;
+ planScopes.current.set(next.id,captured);
+ setLocal({scope:captured,plan:next});
+ const ready=next.items.filter(item=>item.state==='ready');
+ if(!ready.length)return;
+ const summary=ready.map(item=>item.label+(item.targetVersion?' → '+item.targetVersion:'')).join('; ');
+ const accepted=await confirm({title:ui('updates.confirm_title'),message:ui('updates.confirm_help')+' '+summary,confirmLabel:ui('updates.apply')});
+ if(!accepted||!mounted.current||live.current!==captured)return;
+ const batch=await window.launcher.applyComponentUpdates(next.id);
+ if(mounted.current&&live.current===captured)setLocal({scope:captured,plan:next,result:batch});
+ }
+ }catch(reason){if(mounted.current&&live.current===captured)setError({scope:captured,text:reason instanceof Error?reason.message:String(reason)});}
+ finally{inFlight.current=false;if(mounted.current){setPending(false);onBusyChange(false);}}
+ }
+ return <section className="settings-card component-updates" aria-label={ui('updates.title')}>
+ <h2>{ui('updates.title')}</h2><p>{ui('updates.help')}</p>
+ {status?.running&&status.phase?<p role="status">{status.phase}</p>:null}
+ {error?.scope===scope?<p role="alert" className="alert amber">{error.text}</p>:null}
+ <button className="primary" disabled={disabled||running||!apiReady} onClick={()=>void perform()}>{running?<LoaderCircle className="spin"/>:<RefreshCw/>}{ui('updates.action')}</button>
+ {plan?<ul className="component-update-results" aria-label={ui('updates.results')}>
+ {plan.items.map(item=>{
+ const row=applicable?.items.find(result=>result.id===item.id);
+ const label=row?outcomeLabel(row.outcome):item.state==='ready'?ui('updates.ready'):item.state==='unchanged'?ui('updates.unchanged'):item.state==='deferred'?ui('updates.deferred'):ui('updates.skipped');
+ return <li key={item.id}><div><strong>{item.label}</strong><span>{label}</span>{item.currentVersion||item.targetVersion?<small>{item.currentVersion??'…'}{item.targetVersion?' → '+item.targetVersion:''}</small>:null}{row?.message||item.reason?<p>{row?.message??item.reason}</p>:null}</div>
+ {row?.retryable?<button className="secondary" disabled={disabled||running} onClick={()=>void perform(item.id)}>{ui('updates.retry',{name:item.label})}</button>:null}
+ </li>;
+ })}
+ </ul>:null}
+ {applicable?.restartRequired?<p role="status">{ui('updates.restart_help')}</p>:null}
+ </section>;
+}
diff --git a/src/renderer/component-updates.test.tsx b/src/renderer/component-updates.test.tsx
new file mode 100644
index 0000000..dbe2b17
--- /dev/null
+++ b/src/renderer/component-updates.test.tsx
@@ -0,0 +1,48 @@
+// @vitest-environment jsdom
+import {act} from 'react';
+import {createRoot,type Root} from 'react-dom/client';
+import {afterEach,beforeEach,expect,it,vi} from 'vitest';
+import {ComponentUpdates} from './ComponentUpdates';
+import {ConfirmationProvider} from './Confirmation';
+import {demoSnapshot} from '../shared/demo-data';
+import type {ComponentUpdatePlan,ComponentUpdateBatchResult} from '../shared/types';
+let root:Root,data:ReturnType<typeof demoSnapshot>,busy:ReturnType<typeof vi.fn>;
+const plan:ComponentUpdatePlan={id:'opaque-plan',createdAt:'2026-11-03',items:[{id:'backend',component:'backend',label:'Nexus backend',currentVersion:'0.2.3',targetVersion:'0.2.4',state:'ready'},{id:'cachy',component:'runtime',label:'CachyOS',state:'skipped',reason:'Optional family is not installed'}]};
+const result:ComponentUpdateBatchResult={planId:plan.id,items:[{id:'backend',outcome:'updated',committed:true,retryable:false},{id:'cachy',outcome:'skipped',committed:false,retryable:false}],restartRequired:false};
+const render=async(disabled=false)=>act(async()=>root.render(<ConfirmationProvider><ComponentUpdates data={data} disabled={disabled} onBusyChange={busy}/></ConfirmationProvider>));
+const button=(text:string)=>[...document.querySelectorAll<HTMLButtonElement>('button')].find(node=>node.textContent===text)!;
+const click=async(node:Element)=>act(async()=>(node as HTMLElement).click());
+beforeEach(async()=>{
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT',true);data=demoSnapshot();busy=vi.fn();window.launcher={planComponentUpdates:vi.fn(async()=>structuredClone(plan)),applyComponentUpdates:vi.fn(async()=>structuredClone(result)),retryComponentUpdate:vi.fn(async()=>structuredClone(result)),restartLauncher:vi.fn(async()=>{})} as unknown as Window['launcher'];document.body.innerHTML='<div id="root"></div>';root=createRoot(document.getElementById('root')!);await render();
+});
+afterEach(async()=>{await act(async()=>root.unmount());vi.restoreAllMocks();vi.unstubAllGlobals();document.body.innerHTML='';});
+it('does no discovery on mount and sends only opaque plan ID after explicit confirmation',async()=>{
+ expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();await click(button('Update all components'));expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(document.querySelector('[role="dialog"]')?.textContent).toContain('Nexus backend → 0.2.4');await click(button('Apply updates'));expect(window.launcher.applyComponentUpdates).toHaveBeenCalledWith('opaque-plan');expect(document.body.textContent).toContain('Optional family is not installed');expect(document.body.textContent).toContain('Updated');expect(window.launcher.restartLauncher).not.toHaveBeenCalled();expect(busy).toHaveBeenLastCalledWith(false);
+});
+it('cancelling confirmation never applies a plan or installs skipped optional components',async()=>{
+ await click(button('Update all components'));await click(button('Cancel'));expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(document.body.textContent).toContain('Skipped');
+});
+it('offers targeted retry only for main-authorized retryable rows, preserving committed attention wording',async()=>{
+ data.componentUpdates={running:false,plan,result:{...result,items:[{id:'backend',outcome:'committed-needs-attention',committed:true,retryable:false,message:'Selection was published, confirmation failed'},{id:'cachy',outcome:'failed-before-commit',committed:false,retryable:true}]}};await render();expect(document.body.textContent).toContain('Activated, needs attention');expect(button('Retry Nexus backend')).toBeUndefined();await click(button('Retry CachyOS'));expect(window.launcher.retryComponentUpdate).toHaveBeenCalledWith(plan.id,'cachy');expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();
+});
+it('shows explicit restart guidance last without automatically restarting',async()=>{
+ data.componentUpdates={running:false,plan,result:{...result,restartRequired:true}};await render();expect(document.body.textContent).toContain('No restart happens automatically');expect(window.launcher.restartLauncher).not.toHaveBeenCalled();
+});
+it('shows no-update and deferred plans without unnecessary apply or confirmation',async()=>{
+ vi.mocked(window.launcher.planComponentUpdates).mockResolvedValue({...plan,items:plan.items.map(item=>({...item,state:'deferred',reason:'Update launcher then restart first'}))});await click(button('Update all components'));expect(document.querySelector('[role="dialog"]')).toBeNull();expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(document.body.textContent).toContain('Deferred');
+});
+it('blocks duplicate requests and other-activity admission while exposing main progress',async()=>{
+ await render(true);await click(button('Update all components'));expect(window.launcher.planComponentUpdates).not.toHaveBeenCalled();await render();let done!:(value:ComponentUpdatePlan)=>void;vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));await click(button('Update all components'));await click(button('Update all components'));expect(window.launcher.planComponentUpdates).toHaveBeenCalledOnce();await act(async()=>done({...plan,items:[]}));data.componentUpdates={running:true,phase:'Verifying runtime',plan};await render();expect(button('Update all components').disabled).toBe(true);expect(document.querySelector('[role="status"]')?.textContent).toBe('Verifying runtime');
+});
+it('discards an old-account plan while pending and never applies it',async()=>{
+ let done!:(value:ComponentUpdatePlan)=>void;vi.mocked(window.launcher.planComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));await click(button('Update all components'));data={...data,auth:{...data.auth,username:'[email protected]'}};await render();await act(async()=>done(plan));expect(document.querySelector('[role="dialog"]')).toBeNull();expect(window.launcher.applyComponentUpdates).not.toHaveBeenCalled();expect(busy).toHaveBeenLastCalledWith(false);
+});
+it('retains the completed result after its own backend update changes the binary path',async()=>{
+ let done!:(value:ComponentUpdateBatchResult)=>void;vi.mocked(window.launcher.applyComponentUpdates).mockReturnValue(new Promise(resolve=>done=resolve));await click(button('Update all components'));await click(button('Apply updates'));data={...data,backend:{...data.backend,binaryPath:'/new/backend',version:'0.2.4'}};await render();await act(async()=>done(result));expect(document.body.textContent).toContain('Updated');
+});
+
+it.each(['account','root'])('hides an existing snapshot plan/result and retry when %s changes without a new snapshot status',async change=>{
+ data.componentUpdates={running:false,plan,result:{...result,items:[{id:'backend',outcome:'failed-before-commit',committed:false,retryable:true,message:'Old-context failure'}]}};await render();expect(button('Retry Nexus backend')).toBeDefined();
+ if(change==='account')data={...data,auth:{...data.auth,username:'[email protected]'}};else data={...data,settings:{...data.settings,runtimeRoot:'/different/runtime'}};
+ await render();expect(button('Retry Nexus backend')).toBeUndefined();expect(document.querySelector('.component-update-results')).toBeNull();expect(document.body.textContent).not.toContain('Old-context failure');expect(window.launcher.retryComponentUpdate).not.toHaveBeenCalled();
+});
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 8c91441..d98bc69 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -671,3 +671,11 @@ button.primary, button.secondary { border-radius: 5px; min-height: 40px; font-si
.managed-runtime-family + .managed-runtime-family { padding-top: 20px; border-top: 1px solid var(--line); }
.managed-runtime-family p { overflow-wrap: anywhere; }
.managed-runtime-settings > button { margin-top: 16px; }
+
+.component-update-results { list-style: none; padding: 0; margin: 20px 0 0; }
+.component-update-results li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
+.component-update-results li > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
+.component-update-results li small { color: var(--muted); }
+.component-update-results li > button { flex-shrink: 0; }
+@media (max-width: 900px) { .component-update-results li { flex-wrap: wrap; } }
+.component-updates button, .managed-runtime-settings button { min-height: 44px; }