From 9a538313c19c31456a121ff7c915d7fbc30dfa2e Mon Sep 17 00:00:00 2001 From: Aliou Diallo Date: Thu, 2 Apr 2026 18:38:47 +0200 Subject: [PATCH] fix: crash when currentValue is not a string --- .changeset/fix-crash-non-string-currentvalue.md | 5 +++++ components/sectioned-settings.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-crash-non-string-currentvalue.md 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, ); -- 2.51.2