stopPropagation is a method on Event.prototype that uses this internally. When destructured ({ stopPropagation }), it loses its binding to the event object, so calling stopPropagation() throws a TypeError — which silently prevents toggleSavedSound and addSoundToTimeline from ever executing.

Using e.stopPropagation() keeps the method bound to the event. Both buttons should work now.
This commit is contained in:
Nathan Clark 2026-03-17 12:46:52 -05:00
parent 26d523ebad
commit 43bfdcdb93
1 changed files with 6 additions and 8 deletions

View File

@ -504,17 +504,15 @@ function AudioItem({ sound, isPlaying, onPlay }: AudioItemProps) {
onPlay({ sound });
};
const handleSaveClick = ({
stopPropagation,
}: React.MouseEvent<HTMLButtonElement>) => {
stopPropagation();
const handleSaveClick = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
toggleSavedSound({ soundEffect: sound });
};
const handleAddToTimeline = async ({
stopPropagation,
}: React.MouseEvent<HTMLButtonElement>) => {
stopPropagation();
const handleAddToTimeline = async (
e: React.MouseEvent<HTMLButtonElement>,
) => {
e.stopPropagation();
await addSoundToTimeline({ sound });
};