Skip to content

bug: setTimeout calls not cleared on unmount across components #426

Description

@nanaf6203-bit

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

  • All window.setTimeout calls in components are cleared on unmount.
  • Add a custom hook useTimeout / useSafeTimeout to centralise the pattern.
  • Add unit tests asserting cleanup.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working correctlyperformancePerformance / bundle / runtimepriority/p2P2 — medium priority

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions