Skip to content

Commit a11a03b

Browse files
committed
Fixed types in app update
1 parent b849326 commit a11a03b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

DeskThingServer/src/renderer/src/overlays/apps/AppUpdate.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useChannelProgress } from '@renderer/hooks/useProgress'
1414
import { useAppStore, useClientStore, useReleaseStore } from '@renderer/stores'
1515
import { App, PlatformTypes } from '@deskthing/types'
1616
import semverSatisfies from 'semver/functions/satisfies'
17+
import { DownloadErrorOverlay } from '../DownloadErrorOverlay'
1718

1819
type Issues =
1920
| 'checksum'
@@ -158,6 +159,7 @@ const AppUpdate: React.FC<AppSettingProps> = ({ app }: AppSettingProps) => {
158159
pending: 0,
159160
issues: []
160161
})
162+
const [stagedAppError, setStagedAppError] = useState<string | null>(null)
161163

162164
const appRelease = useMemo(
163165
() => appReleases.find((r) => r.id === app.name),
@@ -177,10 +179,10 @@ const AppUpdate: React.FC<AppSettingProps> = ({ app }: AppSettingProps) => {
177179

178180
const handleDownload = async (): Promise<void> => {
179181
const stagedApp = await downloadLatest(app.name)
180-
if (stagedApp) {
181-
setStagedManifest(stagedApp)
182+
if (stagedApp.success) {
183+
setStagedManifest(stagedApp.appManifest)
182184
} else {
183-
// provide feedback
185+
setStagedAppError(stagedApp.message || 'Unknown error')
184186
}
185187
}
186188

@@ -354,6 +356,13 @@ const AppUpdate: React.FC<AppSettingProps> = ({ app }: AppSettingProps) => {
354356
{downloadChannel.isLoading && downloadChannel.progress && (
355357
<LogEntry progressEvent={downloadChannel.progress} />
356358
)}
359+
{stagedAppError && (
360+
<DownloadErrorOverlay
361+
error={stagedAppError}
362+
onAcknowledge={() => setStagedAppError(null)}
363+
title="Failed to stage App"
364+
/>
365+
)}
357366
</div>
358367
)
359368
}

0 commit comments

Comments
 (0)