From 25fbb26fd73b875391655b5eb5b1344f9a7d87c5 Mon Sep 17 00:00:00 2001 From: Joeri Exelmans Date: Sun, 26 Oct 2025 12:54:02 +0100 Subject: [PATCH] cleanup sounds that are done playing --- src/App/App.tsx | 2 +- src/App/Plant/Microwave/useAudioContext.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/App/App.tsx b/src/App/App.tsx index c2ecc69..75fbca9 100644 --- a/src/App/App.tsx +++ b/src/App/App.tsx @@ -406,7 +406,7 @@ export function App() { flex: '0 0 content', overflowY: "auto", overflowX: "visible", - maxWidth: '50vw', + maxWidth: 'min(400px, 50vw)', }}>
[...sounds, src]); + src.addEventListener("ended", () => { + setSounds(sounds => sounds.filter(s => s !== src)); + }) return src; }); // return callback to stop playing