diff --git a/.changeset/fix-crash-non-string-currentvalue.md b/.changeset/fix-crash-non-string-currentvalue.md new file mode 100644 index 0000000..df74b2a --- /dev/null +++ b/.changeset/fix-crash-non-string-currentvalue.md @@ -0,0 +1,5 @@ +--- +"@aliou/pi-utils-settings": patch +--- + +Fix crash when `currentValue` is not a string (e.g. boolean from config storage) diff --git a/components/sectioned-settings.ts b/components/sectioned-settings.ts index 5fe8c4f..dffbf99 100644 --- a/components/sectioned-settings.ts +++ b/components/sectioned-settings.ts @@ -218,7 +218,7 @@ export class SectionedSettings implements Component { const usedWidth = prefixWidth + maxLabelWidth + visibleWidth(separator); const valueMaxWidth = width - usedWidth - 2; const valueText = this.theme.value( - truncateToWidth(item.currentValue, valueMaxWidth, ""), + truncateToWidth(String(item.currentValue ?? ""), valueMaxWidth, ""), isSelected, );