Skip to content

Commit

Permalink
Display empty repositories table instead of nothing on query error
Browse files Browse the repository at this point in the history
This was only possible when there was an error upon first navigating to
the repositories page. Otherwise, we'd display previous results.
  • Loading branch information
isker committed Oct 24, 2023
1 parent 9f80401 commit d0378bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-singers-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"neogrok": patch
---

Display empty repositories table instead of nothing when there's a query error
19 changes: 8 additions & 11 deletions src/routes/repositories/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@
>
</svelte:head>

<!--
We hoist this above the conditions so that it never gets destroyed/remounted
as we transition among the states they represent. This is important for
proper maintenance of the intricate synchronization between the route state
and the form state.
-->
<SearchForm
queryError={data.listOutcome.kind === "error" ? data.listOutcome.error : null}
/>
{#if data.listOutcome.kind === "error" && previousListResults}
<RepositoriesList results={previousListResults} />
{:else if data.listOutcome.kind === "success"}
<RepositoriesList results={data.listOutcome.results} />
{/if}
<RepositoriesList
results={data.listOutcome.kind === "success"
? data.listOutcome.results
: previousListResults ?? {
repositories: [],
stats: { fileCount: 0, contentBytes: 0, indexBytes: 0 },
}}
/>
1 change: 0 additions & 1 deletion src/routes/repositories/repositories-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
} = results);
</script>

<!-- TODO accept null results, render empty table -->
<!-- FIXME perf is bad on an instance with thousands of repos. -->
<!-- FIXME the file count/ram size data is for repo shards matching the query,
but that's not understandable from the UI -->
Expand Down

0 comments on commit d0378bc

Please sign in to comment.