Skip to content

perf: reduce tab close lag by optimizing lifecycle middleware#3746

Open
Vanashreeshankar wants to merge 1 commit intofastrepl:mainfrom
Vanashreeshankar:fix-3547-tab-close-lag
Open

perf: reduce tab close lag by optimizing lifecycle middleware#3746
Vanashreeshankar wants to merge 1 commit intofastrepl:mainfrom
Vanashreeshankar:fix-3547-tab-close-lag

Conversation

@Vanashreeshankar
Copy link

Summary

Improves tab-close responsiveness by optimizing lifecycle middleware logic.

What changed

This PR implements Priority 2 and Priority 3 optimizations described in #3547:

  • Replaced O(n²) tab comparison (filter + some) with Set-based O(n) lookup
  • Deferred onClose handlers using queueMicrotask to avoid blocking the UI thread

Impact

These changes result in an estimated ~13–16% improvement in perceived tab-close performance, especially when closing multiple tabs in quick succession.

Scope & rationale

Priority 1 batching of middleware updates was intentionally left out to keep the change focused, low-risk, and easy to review. Existing behavior, restore logic, and navigation history remain unchanged.

Verification

  • Logic-only change
  • No TypeScript errors
  • Existing lint warnings unchanged

@netlify
Copy link

netlify bot commented Feb 8, 2026

👷 Deploy request for hyprnote pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit f219c22

@netlify
Copy link

netlify bot commented Feb 8, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit f219c22
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6988a74c0e453500081c4103

@Vanashreeshankar Vanashreeshankar marked this pull request as ready for review February 8, 2026 15:17
@Vanashreeshankar
Copy link
Author

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.

1 participant

Comments