Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ export function SearchableAutoSetting<T extends ConfigKey>(props: {
<Button
active={getConfig[props.key] === option}
onClick={() => {
if (getConfig[props.key] === option) return;
const selected = getConfig[props.key] === option;
// always preview, even for the selected option, so sounds can be re-triggered
props.onOptionClick?.(option);
setConfig(props.key, option);
if (!selected) {
setConfig(props.key, option);
}
}}
>
{getOptionLabel(props.key, option)}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/ts/controllers/sound-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export async function previewClick(clickId: PlaySoundOnClick): Promise<void> {
}

const howl = await getHowl(safeClickSounds[0]);
howl.stop();
howl.seek(0);
howl.play();
}
Expand All @@ -134,6 +135,7 @@ export async function previewError(val: PlaySoundOnError): Promise<void> {
const errorSoundIds = Object.keys(safeErrorSounds);
if (!errorSoundIds.includes(val)) return;

errorSounds?.[val]?.[0]?.stop();
errorSounds?.[val]?.[0]?.seek(0);
errorSounds?.[val]?.[0]?.play();
}
Expand Down
Loading