Skip to content

Commit

Permalink
Fix multiple folders being highlighted in server picker
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed May 15, 2024
1 parent f1fbd4d commit 7f2cbf4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/lib/components/RemoteServerPicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@
// If the path is root and it is a valid install, don't list contents of root
$: actualDisplayedItems = (valid && displayedPath === trimmedPath) ? [{ path: '', name: '(root)', isValidInstall: true }] : displayedItems;
function isSamePath(path1: string, path2: string) {
let parts1 = _.compact(path1.split(pathSeparator));
let parts2 = _.compact(path2.split(pathSeparator));
return _.isEqual(parts1, parts2);
}
</script>

<div class="relative">
Expand All @@ -180,7 +186,7 @@
{#each actualDisplayedItems as item}
<button
class="w-full btn !scale-100"
class:variant-ghost-primary={path.startsWith(item.path) && valid}
class:variant-ghost-primary={isSamePath(path, item.path) && valid}
disabled={pendingDisplay || pendingValidCheck}
on:click={() => select(item)}>
<SvgIcon
Expand Down

0 comments on commit 7f2cbf4

Please sign in to comment.