Skip to content

Commit

Permalink
fix: fix color picker for PCA9632 (#2028)
Browse files Browse the repository at this point in the history
* fix: fix color picker for PCA9632

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: remove fallback and set value only when it is an Array or String

Signed-off-by: Stefan Dej <meteyou@gmail.com>

---------

Signed-off-by: Stefan Dej <meteyou@gmail.com>
  • Loading branch information
meteyou authored Nov 7, 2024
1 parent 6616059 commit ae7f8f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/store/printer/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,13 @@ export const getters: GetterTree<PrinterState, RootState> = {
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 = ''
Expand Down

0 comments on commit ae7f8f1

Please sign in to comment.