Fix makeTrimmedStringSetting to actually trim whitespace
The passthrough() transformation was an identity function that bypassed TrimmedString's whitespace-trimming decode logic. This meant whitespace-only inputs like " " would not be trimmed to empty and would not trigger the fallback in makeBinaryPathSetting. Fix by using TrimmedString directly (which is Schema.Trim and actively trims on decode) instead of piping Schema.String through a passthrough to TrimmedString.
This commit is contained in:
1 file changed
+1
-4
@@ -23,10 +23,7 @@ export const SidebarThreadSortOrder = Schema.Literals(["updated_at", "created_at
|
||||
export type SidebarThreadSortOrder = typeof SidebarThreadSortOrder.Type;
|
||||
export const DEFAULT_SIDEBAR_THREAD_SORT_ORDER: SidebarThreadSortOrder = "updated_at";
|
||||
|
||||
const makeTrimmedStringSetting = (description: string) =>
|
||||
Schema.String.annotate({ description }).pipe(
|
||||
Schema.decodeTo(TrimmedString, SchemaTransformation.passthrough()),
|
||||
);
|
||||
const makeTrimmedStringSetting = (description: string) => TrimmedString.annotate({ description });
|
||||
|
||||
export const ClientSettingsSchema = Schema.Struct({
|
||||
confirmThreadArchive: Schema.Boolean.annotate({
|
||||
|
||||
Reference in new issue
Block a user