Summary
setTimeout calls in many components are not cleared on unmount when the component disappears mid-flight.
Affected area
src/components/ComparisonBar.tsx (copy timeout)
src/components/dashboard/StakingModal.tsx (setTimeout(() => setStep('input'), 300))
src/components/dashboard/DataRefreshWrapper.tsx (setTimeout(() => { … }, 2000), setInterval-style)
src/components/dashboard/PortfolioReport.tsx
src/components/kyc/KycVerificationCenter.tsx
src/components/property/SetPriceAlertModal.tsx
src/components/referral/ClaimRewardsModal.tsx (setTimeout(onClose, 3000))
src/components/referral/ReferralLinksCard.tsx
src/components/responsive/LazyLoadingExample.tsx
src/components/TransactionMonitor.tsx
src/app/widget/embed-code/page.tsx
Steps to reproduce / impact
Memory leaks, state updates on unmounted component (React 18 warning), cancellation races on rapid user interaction.
Expected behaviour
Store timers in refs and clear them in the component's cleanup effect, or use AbortController-based helpers.
Acceptance criteria
Summary
setTimeoutcalls in many components are not cleared on unmount when the component disappears mid-flight.Affected area
src/components/ComparisonBar.tsx(copy timeout)src/components/dashboard/StakingModal.tsx(setTimeout(() => setStep('input'), 300))src/components/dashboard/DataRefreshWrapper.tsx(setTimeout(() => { … }, 2000),setInterval-style)src/components/dashboard/PortfolioReport.tsxsrc/components/kyc/KycVerificationCenter.tsxsrc/components/property/SetPriceAlertModal.tsxsrc/components/referral/ClaimRewardsModal.tsx(setTimeout(onClose, 3000))src/components/referral/ReferralLinksCard.tsxsrc/components/responsive/LazyLoadingExample.tsxsrc/components/TransactionMonitor.tsxsrc/app/widget/embed-code/page.tsxSteps to reproduce / impact
Memory leaks, state updates on unmounted component (React 18 warning), cancellation races on rapid user interaction.
Expected behaviour
Store timers in refs and clear them in the component's cleanup effect, or use AbortController-based helpers.
Acceptance criteria
window.setTimeoutcalls in components are cleared on unmount.useTimeout/useSafeTimeoutto centralise the pattern.