Skip to content

Commit 5a73d49

Browse files
committed
Fixes #3846 shows correct message when Launchpad has an error
1 parent d14ace1 commit 5a73d49

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/plus/launchpad/utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ import type { LaunchpadSummaryResult } from './launchpadIndicator';
44
import { generateLaunchpadSummary } from './launchpadIndicator';
55
import type { LaunchpadGroup } from './launchpadProvider';
66

7-
export async function getLaunchpadSummary(container: Container): Promise<LaunchpadSummaryResult> {
7+
export async function getLaunchpadSummary(container: Container): Promise<LaunchpadSummaryResult | { error: Error }> {
88
const result = await container.launchpad.getCategorizedItems();
9-
const groups: LaunchpadGroup[] = configuration.get('launchpad.indicator.groups') ?? [];
109

10+
if (result.error != null) {
11+
return {
12+
error: result.error,
13+
};
14+
}
15+
16+
const groups: LaunchpadGroup[] = configuration.get('launchpad.indicator.groups') ?? [];
1117
return generateLaunchpadSummary(result.items, groups);
1218
}

src/webviews/apps/plus/home/components/launchpad.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ export class GlLaunchpad extends SignalWatcher(LitElement) {
200200

201201
private renderSummary(summary: LaunchpadSummary | undefined) {
202202
if (summary == null) return nothing;
203+
204+
if ('error' in summary) {
205+
return html`<ul class="menu">
206+
<li>Unable to load items</li>
207+
</ul>`;
208+
}
209+
203210
if (summary.total === 0) {
204211
return html`<ul class="menu">
205212
<li>You are all caught up!</li>

src/webviews/home/protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export interface OverviewFilters {
4444
export interface GetLaunchpadSummaryRequest {
4545
[key: string]: unknown;
4646
}
47-
export type GetLaunchpadSummaryResponse = LaunchpadSummaryResult | undefined;
47+
export type GetLaunchpadSummaryResponse = LaunchpadSummaryResult | { error: Error } | undefined;
4848
export const GetLaunchpadSummary = new IpcRequest<GetLaunchpadSummaryRequest, GetLaunchpadSummaryResponse>(
4949
scope,
5050
'launchpad/summary',

0 commit comments

Comments
 (0)