From 5deaf92373263c89ba330dd35177594217a00822 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 20:20:15 +0100 Subject: [PATCH] Fix TypeError when loading UI with custom palette selected (#5205) * Add null check to fix circular dependency with custom palettes Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> * Refactor: move null check earlier for better efficiency Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> --- wled00/data/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/data/index.js b/wled00/data/index.js index d61f25e1..68d8b2ab 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -1783,7 +1783,8 @@ function updateSelectedPalette(s) if (selElement) selElement.classList.remove('selected'); var selectedPalette = parent.querySelector(`.lstI[data-id="${s}"]`); - if (selectedPalette) parent.querySelector(`.lstI[data-id="${s}"]`).classList.add('selected'); + if (!selectedPalette) return; // palette not yet loaded (custom palette on initial load) + selectedPalette.classList.add('selected'); // in case of special palettes (* Colors...), force show color selectors (if hidden by effect data) let cd = gId('csl').children; // color selectors