-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Description
Memory Leak - Interval Not Cleared on Component Unmount
File: tabs/src/components/ReceivePayment.tsx:60-90
Issue: The setInterval polling for payment status is never cleared when the component unmounts. This leads to:
- Memory leaks as intervals continue running in background
- Potential state updates on unmounted components
- Multiple intervals stacking if user reopens the modal
Current Code:
intervalId.current = setInterval(() => {
getWalletPayments(myLNbitDetails.privateWallet?.inkey || '').then(
payments => {
if (payments.length > 0) {
// ... payment logic
}
}
);
}, 5000); // Check every 5 seconds - NEVER CLEANED UP ON UNMOUNT
Fix Required: Add cleanup in useEffect return function:
useEffect(() => {
return () => {
if (intervalId.current !== null) {
clearInterval(intervalId.current);
}
};
}, []);
Impact:
- Sensitive data (wallet IDs, balances, user info) logged to browser console in production
- Inconsistent logging makes debugging difficult
- No control over log levels in different environments
- Sensitive Data Exposure in Logs
Files:
- tabs/src/components/PurchasePopup.tsx:20 - Store owner email logged
- tabs/src/components/PurchasePopup.tsx:47-48 - Wallet ID and balance logged
- tabs/src/services/authConfig.tsx:4 - AAD Client ID logged
Issue: Sensitive configuration and user data is being logged to the console, which is visible in production browser dev tools.