Skip to content

Commit

Permalink
Add some TODOs and remove some unneeded keys
Browse files Browse the repository at this point in the history
My React brain added some keys in places that I now know did not need
them.
  • Loading branch information
isker committed Sep 5, 2023
1 parent 9d2ce6a commit 389201f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/lib/server/opengrok-compat.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as v from "@badrap/valita";
import fs from "node:fs";

// TODO we should have one environment variable pointing at a single
// configuration file, so that we can extend the configuration later without
// introducing new env vars.

/**
* Users may provide a simple JSON file that maps from OpenGrok project names to
* Zoekt repo names, in case project names changed.
Expand Down
11 changes: 9 additions & 2 deletions src/routes/(search-page)/search-results-file.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,23 @@
<SearchResultsFileHeader {file} {rank} />
{#if lineGroups.length > 0}
<div class="font-mono text-sm divide-y">
{#each lineGroups as lines (lines[0].lineNumber)}
{#each lineGroups as lines}
<!--
minmax because we don't want the line number column to slide left and
right as you scroll down through sections with different `min-content`s'
worth of line numbers. 2rem is enough for 4 digits.
TODO grid isn't doing a whole lot for us here, and browsers will
reject grids with more than a certain number of rows:
https://stackoverflow.com/a/63247486. We can probably simulate the
grid minmax calculation ourselves, as we trivially know the number of
digits in the maximum line number. Alternatively, a simple small fixed
value will probably be acceptable.
-->
<div
class="py-1 grid grid-cols-[minmax(2rem,_min-content)_1fr] gap-x-2 whitespace-pre overflow-x-auto"
>
{#each lines as { lineNumber, lineTokens } (lineNumber)}
{#each lines as { lineNumber, lineTokens }}
<span class="select-none text-gray-600 text-right pr-1">
{#if file.fileUrl && file.lineNumberTemplate}
<a
Expand Down
2 changes: 2 additions & 0 deletions src/routes/(search-page)/search-results.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
{Math.floor(duration / 1e4) / 1e2}
ms
</span>
<!-- TODO indicate when frontend files/matches are limited by the parameters in the search form -->
<span class="ml-auto">
Frontend: {files.length}
{files.length === 1 ? "file" : "files"} / {frontendMatchCount}
{frontendMatchCount === 1 ? "match" : "matches"} / {requestDuration}ms
</span>
</h1>
<!-- TODO enable removing this key by making SearchResultsFile reset its internal state when props change. -->
{#each files as file, i (`${file.repository}/${file.fileName.tokens
.map(({ text }) => text)
.join()}@${file.branches.join(";")}`)}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/repositories/repositories-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ but that's not understandable from the UI -->
</tr>
</thead>
<tbody>
{#each repositories as repository (repository.name)}
{#each repositories as repository}
<Repository {repository} />
{/each}
</tbody>
Expand Down

0 comments on commit 389201f

Please sign in to comment.