mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 00:58:32 +02:00
Remove duplicate themes in getThemes function
This commit is contained in:
@@ -6,7 +6,9 @@ import { resolveAppearance } from './appearance';
|
|||||||
export async function getThemes() {
|
export async function getThemes() {
|
||||||
const themes = (await invokeCmd<GetThemesResponse[]>('cmd_get_themes')).flatMap((t) => t.themes);
|
const themes = (await invokeCmd<GetThemesResponse[]>('cmd_get_themes')).flatMap((t) => t.themes);
|
||||||
themes.sort((a, b) => a.label.localeCompare(b.label));
|
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(
|
export async function getResolvedTheme(
|
||||||
|
|||||||
Reference in New Issue
Block a user