diff --git a/frontend/src/components/CrackerPanel.tsx b/frontend/src/components/CrackerPanel.tsx index 7d43546..421d446 100644 --- a/frontend/src/components/CrackerPanel.tsx +++ b/frontend/src/components/CrackerPanel.tsx @@ -98,6 +98,7 @@ export function CrackerPanel({ const twoWordModeRef = useRef(false); const undecryptedIdsRef = useRef>(new Set()); const seenPayloadsRef = useRef>(new Set()); + const existingChannelKeysRef = useRef>(new Set()); // Initialize cracker and NoSleep useEffect(() => { @@ -155,6 +156,10 @@ export function CrackerPanel({ [channels] ); + useEffect(() => { + existingChannelKeysRef.current = existingChannelKeys; + }, [existingChannelKeys]); + // Filter packets to only undecrypted GROUP_TEXT const undecryptedGroupText = packets.filter( (p) => p.payload_type === 'GROUP_TEXT' && !p.decrypted @@ -365,7 +370,7 @@ export function CrackerPanel({ // Auto-add channel if not already exists const keyUpper = result.key.toUpperCase(); - if (!existingChannelKeys.has(keyUpper)) { + if (!existingChannelKeysRef.current.has(keyUpper)) { try { const channelName = '#' + result.roomName; await onChannelCreate(channelName, result.key); @@ -426,7 +431,7 @@ export function CrackerPanel({ if (isRunningRef.current) { setTimeout(() => processNext(), 100); } - }, [existingChannelKeys, onChannelCreate]); + }, [onChannelCreate]); // Start/stop handlers const handleStart = () => {