Remove duplicate themes in getThemes function

This commit is contained in:
Gregory Schier
2025-10-22 06:56:00 -07:00
parent 7e2d72c4e3
commit b7682db9a3

View File

@@ -6,7 +6,9 @@ import { resolveAppearance } from './appearance';
export async function getThemes() {
const themes = (await invokeCmd<GetThemesResponse[]>('cmd_get_themes')).flatMap((t) => t.themes);
themes.sort((a, b) => a.label.localeCompare(b.label));
return { themes: [yaakDark, yaakLight, ...themes] };
// Remove duplicates, in case multiple plugins provide the same theme
const uniqueThemes = Array.from(new Map(themes.map((t) => [t.id, t])).values());
return { themes: [yaakDark, yaakLight, ...uniqueThemes] };
}
export async function getResolvedTheme(