Skip to content

Commit 52a86a7

Browse files
committed
Don’t allow dupes in usePantry().ls()
1 parent 263d074 commit 52a86a7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/hooks/usePantry.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ export default function usePantry() {
4949
const prefix = config.prefix.join('tea.xyz/var/pantry/projects')
5050

5151
async function* ls(): AsyncGenerator<LsEntry> {
52+
const seen = new Set()
53+
5254
for (const prefix of pantry_paths()) {
5355
for await (const path of _ls_pantry(prefix)) {
54-
yield {
55-
project: path.parent().relative({ to: prefix }),
56-
path
56+
const project = path.parent().relative({ to: prefix })
57+
if (seen.insert(project).inserted) {
58+
yield { project, path }
5759
}
5860
}
5961
}

0 commit comments

Comments
 (0)