Deduplicate repos in loadAll to prevent repeated sessions
Symlinks or multiple entries can resolve to the same repoRoot, causing duplicate sessions in the returned list.
This commit is contained in:
parent
9f54ec9d51
commit
f50d8eb90e
|
|
@ -61,6 +61,7 @@ export interface GlobalSession extends Session {
|
||||||
export async function loadAll(): Promise<GlobalSession[]> {
|
export async function loadAll(): Promise<GlobalSession[]> {
|
||||||
const sandlotDir = join(homedir(), ".sandlot")
|
const sandlotDir = join(homedir(), ".sandlot")
|
||||||
const all: GlobalSession[] = []
|
const all: GlobalSession[] = []
|
||||||
|
const seen = new Set<string>()
|
||||||
|
|
||||||
let repoDirs
|
let repoDirs
|
||||||
try {
|
try {
|
||||||
|
|
@ -89,7 +90,8 @@ export async function loadAll(): Promise<GlobalSession[]> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repoRoot) {
|
if (repoRoot && !seen.has(repoRoot)) {
|
||||||
|
seen.add(repoRoot)
|
||||||
try {
|
try {
|
||||||
const st = await load(repoRoot)
|
const st = await load(repoRoot)
|
||||||
for (const session of Object.values(st.sessions)) {
|
for (const session of Object.values(st.sessions)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user