From ae7f8f14d9f99a896f0bbd2df743502d4a14ae69 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 7 Nov 2024 10:49:22 +0100 Subject: [PATCH] fix: fix color picker for PCA9632 (#2028) * fix: fix color picker for PCA9632 Signed-off-by: Stefan Dej * refactor: remove fallback and set value only when it is an Array or String Signed-off-by: Stefan Dej --------- Signed-off-by: Stefan Dej --- src/store/printer/getters.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/store/printer/getters.ts b/src/store/printer/getters.ts index ba0204e27..ce9b15fa9 100644 --- a/src/store/printer/getters.ts +++ b/src/store/printer/getters.ts @@ -228,7 +228,13 @@ export const getters: GetterTree = { let singleChannelTarget = null const colorData = object.state.color_data ?? [] - if ('color_order' in object.settings) colorOrder = object.settings.color_order[0] ?? '' + if ('color_order' in object.settings) { + if (typeof object.settings.color_order === 'string') { + colorOrder = object.settings.color_order + } else if (Array.isArray(object.settings.color_order) && object.settings.color_order.length > 0) { + colorOrder = object.settings.color_order[0] + } + } if (object.type === 'led') { colorOrder = ''