Skip to content

Commit a8d895f

Browse files
committed
notebooks, batch-changes: tweak loading
1 parent 252f7c1 commit a8d895f

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

src/components/FindNotebooksCommand.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default function FindNotebooksCommand({ src }: { src: Sourcegraph }) {
5151
selectedItemId={length > 0 ? "first-result" : undefined}
5252
throttle
5353
>
54-
{!loading && !searchText ? (
54+
{!loading && !searchText && (
5555
<List.Section title={"Suggestions"}>
5656
<List.Item
5757
title="Create a search notebook"
@@ -63,17 +63,15 @@ export default function FindNotebooksCommand({ src }: { src: Sourcegraph }) {
6363
}
6464
/>
6565
</List.Section>
66-
) : (
67-
<Fragment />
6866
)}
6967

70-
{notebooks && (
71-
<List.Section title={searchText ? "Notebooks" : "Recent notebooks"}>
72-
{notebooks.map((n, i) => (
73-
<NotebookResultItem id={i === 0 ? "first-result" : undefined} key={nanoid()} notebook={n} src={src} />
74-
))}
75-
</List.Section>
76-
)}
68+
{loading && length === 0 && <List.EmptyView icon={Icon.MugSteam} title={"Loading..."} />}
69+
70+
<List.Section title={searchText ? "Notebooks" : "Recent notebooks"}>
71+
{notebooks?.map((n, i) => (
72+
<NotebookResultItem id={i === 0 ? "first-result" : undefined} key={nanoid()} notebook={n} src={src} />
73+
))}
74+
</List.Section>
7775
</List>
7876
);
7977
}

src/components/ManageBatchChangesCommand.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ActionPanel, List, Action, Icon, useNavigation, Toast, Image, Color, showToast, Form } from "@raycast/api";
22
import { getProgressIcon } from "@raycast/utils";
3-
import { useState, Fragment, useMemo, useEffect } from "react";
3+
import { useState, useMemo, useEffect } from "react";
44
import { DateTime } from "luxon";
55
import { nanoid } from "nanoid";
66

@@ -57,10 +57,10 @@ export default function ManageBatchChanges({ src }: { src: Sourcegraph }) {
5757
isLoading={loading}
5858
searchBarPlaceholder={`Manage batch changes on ${srcName}`}
5959
onSearchTextChange={setSearchText}
60-
enableFiltering={true}
60+
filtering={true}
6161
selectedItemId={showSuggestions ? "first-result" : undefined}
6262
>
63-
{showSuggestions ? (
63+
{showSuggestions && (
6464
<List.Section title={"Suggestions"}>
6565
<List.Item
6666
title="Create a batch change"
@@ -72,8 +72,6 @@ export default function ManageBatchChanges({ src }: { src: Sourcegraph }) {
7272
}
7373
/>
7474
</List.Section>
75-
) : (
76-
<Fragment />
7775
)}
7876

7977
<List.Section title={"Batch changes"}>

src/findNotebooksInstance.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import FindNotebooksCommand from "./components/FindNotebooksCommand";
22
import InstanceCommand from "./components/InstanceCommand";
33

4-
export default async function FindNotebooksInstance() {
4+
export default function FindNotebooksInstance() {
55
return <InstanceCommand Command={FindNotebooksCommand} />;
66
}

0 commit comments

Comments
 (0)