prevent error when theme selector isn't present

This commit is contained in:
Cory LaViska
2025-06-26 11:59:20 -04:00
parent ac4f97dd0e
commit be7808e72f

View File

@@ -26,7 +26,7 @@ async function updateTheme(value, isInitialLoad = false) {
// Get brand and palette from the selected option
const themeSelector = document.querySelector('.theme-selector');
const selectedOption = themeSelector.querySelector(`wa-option[value="${value}"]`);
const selectedOption = themeSelector?.querySelector(`wa-option[value="${value}"]`);
const brand = selectedOption?.getAttribute('data-brand') || 'blue';
const palette = selectedOption?.getAttribute('data-palette') || 'default';
const htmlElement = document.documentElement;