Skip to content

feat: cleanup pending timeouts on component unmount - #486

Open
Priyanshu1-62 wants to merge 1 commit into
Nsanjayboruds:mainfrom
Priyanshu1-62:feat/add-timeout-cleanup
Open

feat: cleanup pending timeouts on component unmount#486
Priyanshu1-62 wants to merge 1 commit into
Nsanjayboruds:mainfrom
Priyanshu1-62:feat/add-timeout-cleanup

Conversation

@Priyanshu1-62

Copy link
Copy Markdown

Pull Request

Summary

  • Improved timeout lifecycle management in the AI assistant component by tracking all scheduled timeouts and clearing pending ones during component unmount.
  • This prevents delayed state updates and navigation callbacks from executing after the component has been removed, making the component more resilient during rapid navigation and unmount/remount scenarios.

Description

  • Added a useRef with a Set to track active timeout IDs.
  • Introduced a scheduleTimeout helper to centralize timeout registration and to automatically remove completed timers from the tracking set.
  • Replaced direct setTimeout calls with scheduleTimeout across delayed bot responses and login redirection flows.
  • Extended the component cleanup function to clear all pending timeouts.

Related Issue

Fixes #478

Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Documentation update
  • UI/UX improvement
  • Refactoring

Checklist

  • Code follows project guidelines
  • Tested locally
  • No console errors
  • Documentation updated if required

Additional Details

  • Labels: GSSoC'2026, type: enhancement, type: performance

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT]: Add cleanup for delayed timeout callbacks

1 participant