diff --git a/frontend/src/components/WatchlistTab.tsx b/frontend/src/components/WatchlistTab.tsx index b706d5d..e6f8e53 100644 --- a/frontend/src/components/WatchlistTab.tsx +++ b/frontend/src/components/WatchlistTab.tsx @@ -186,10 +186,23 @@ export function WatchlistTab({ spots, spotStatus, onSpotSelect, onSpotClick }: P } catch (e: any) { flash(String(e?.message ?? e), true); } }; + // Armed through a REF, checked synchronously: the state variable is captured + // at render time, so a quick double-click read the pre-arm value twice and + // both clicks merely armed — the bin turned red and nothing was ever removed. + const removeArmRef = useRef(''); const remove = async (call: string) => { - if (removeArm !== call) { setRemoveArm(call); window.setTimeout(() => setRemoveArm(''), 2500); return; } + if (removeArmRef.current !== call) { + removeArmRef.current = call; + setRemoveArm(call); + window.setTimeout(() => { + if (removeArmRef.current === call) { removeArmRef.current = ''; setRemoveArm(''); } + }, 3000); + return; + } + removeArmRef.current = ''; + setRemoveArm(''); try { await WatchlistRemove(call); await refresh(); } - catch (e: any) { setError(String(e?.message ?? e)); } + catch (e: any) { flash(String(e?.message ?? e), true); } }; const isOnAir = (e: WLEntry): boolean =>