From 351400b82efdf5495aa2f06ca07262bcc9602952 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Fri, 4 Jun 2021 12:11:04 -0700 Subject: [PATCH] Panels: avoid crash while switching between panels types (#35286) --- .../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); }