From 9043bede59055ce6baa2633c93926a279e6772d4 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Thu, 21 May 2026 14:11:30 +0100 Subject: [PATCH] chore: handle case where theme is undefined --- apps/dashboard/src/lib/utils/functions/theme.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/src/lib/utils/functions/theme.ts b/apps/dashboard/src/lib/utils/functions/theme.ts index 6fa4f378..167d3a73 100644 --- a/apps/dashboard/src/lib/utils/functions/theme.ts +++ b/apps/dashboard/src/lib/utils/functions/theme.ts @@ -2,10 +2,10 @@ import { darken, lighten } from 'color2k'; import { tc } from '$lib/utils/functions/trycatch'; -export function setTheme(theme: string) { +export function setTheme(theme: string = '') { localStorage.setItem('theme', theme); - if (theme.includes('#')) { + if (theme?.includes('#')) { const escapedHex = theme.replace(/"/g, '\\"'); document.body.setAttribute('data-theme', escapedHex);