From d76bcd082ff1f8db4f299de9f7688da7990b3ff0 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Fri, 4 Jun 2021 15:36:57 -0400 Subject: [PATCH] Panels: avoid crash while switching between panels types (#35286) (#35289) (cherry picked from commit 351400b82efdf5495aa2f06ca07262bcc9602952) Co-authored-by: Ryan McKinley --- .../features/dashboard/state/getPanelOptionsWithDefaults.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/state/getPanelOptionsWithDefaults.ts b/public/app/features/dashboard/state/getPanelOptionsWithDefaults.ts index 2bf513a9e9a..ebe9e9c4c5b 100644 --- a/public/app/features/dashboard/state/getPanelOptionsWithDefaults.ts +++ b/public/app/features/dashboard/state/getPanelOptionsWithDefaults.ts @@ -198,7 +198,9 @@ export function restoreCustomOverrideRules(current: FieldConfigSource, old: Fiel if (isCustomFieldProp(prop)) { const currentOverride = result.overrides.find((o) => isEqual(o.matcher, override.matcher)); if (currentOverride) { - currentOverride.properties.push(prop); + if (currentOverride !== override) { + currentOverride.properties.push(prop); + } } else { result.overrides.push(override); }