Skip to content

Commit 81b8e58

Browse files
committed
fix: normalize orphaned random-custom completion sound on rehydrate
Adds a guard in the persist merge function so that if completionSound is "random-custom" but customSounds is empty, it falls back to "none". Prevents the Select trigger rendering a ghost value after a partial rehydrate or app-version transition that leaves the library empty. Generated-By: PostHog Code Task-Id: 2e7e511c-6b31-4480-8ac1-37863ddd7c3b
1 parent db65f2f commit 81b8e58

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/ui/src/features/settings/settingsStore.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ export const useSettingsStore = create<SettingsStore>()(
469469
if ((merged.autoConvertLongText as string) === "500") {
470470
(merged as Record<string, unknown>).autoConvertLongText = "1000";
471471
}
472+
if (
473+
merged.completionSound === "random-custom" &&
474+
(!merged.customSounds || merged.customSounds.length === 0)
475+
) {
476+
(merged as Record<string, unknown>).completionSound = "none";
477+
}
472478
return merged;
473479
},
474480
},

0 commit comments

Comments
 (0)