Skip to content

Conversation

@welkinwong
Copy link
Contributor

Summary

This PR primarily addresses the performance issue described in #454.

Problem Analysis

In the original implementation, the cache was immediately cleared every time a Promise was thrown and resolved. This caused components to re-throw Promises upon updates, leading to an exponential growth in Promise throwing when multiple useTracker hooks were used concurrently.

Solution

The key insight is that immediate cache clearance is only necessary on the Server-Side. This optimization significantly reduces unnecessary Promise re-throws and improves performance in components with multiple useTracker instances.

Additional Changes

  • Rebuilt majority of the test cases for useTracker with Suspense functionality
  • Added comprehensive performance testing for multiple subscription scenarios

@Grubba27
Copy link
Contributor

Nice! I was going to tackle this today and your solution seems very elegant!

this closes #454

Copy link
Contributor

@Grubba27 Grubba27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'll release a beta with these changes and we can test around

…ker with suspense exist and rebuild test cases. Closes meteor#454
@Grubba27 Grubba27 mentioned this pull request Oct 17, 2025
@Grubba27 Grubba27 changed the base branch from master to feature/4.0.1 October 17, 2025 14:30
@Grubba27 Grubba27 merged commit 55752a9 into meteor:feature/4.0.1 Oct 17, 2025
2 checks passed
@Grubba27
Copy link
Contributor

Published this under [email protected] please give a test and let me know!

@welkinwong
Copy link
Contributor Author

welkinwong commented Oct 18, 2025

Published this under [email protected] please give a test and let me know!

@Grubba27 during testing of version 4.0.1-beta.0, I identified an issue with the withDeps implementation and have submitted a new PR (#457) to address it.

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.

2 participants