meteor / react-packages

Meteor packages for a great React developer experience
http://guide.meteor.com/react.html
Other
573 stars 158 forks source link

Fix component doesn't update without deps in StrictMode - fixes #278 #282

Closed CaptainN closed 4 years ago

CaptainN commented 4 years ago

When the hook is used without deps (including through withTracker), the component will not update correctly on the second render. This PR solves that by always forcing render after the render is committed in withTracker.

menelike commented 4 years ago

@CaptainN Not wanting to put additional work on your shoulders, but the bug you described cries for a proper unit test, WDYT?

CaptainN commented 4 years ago

@menelike Yeah, It's on my list. I first have to get the tests working again (preferably on the typescript branch). I mostly have them working, but TinyTest is kind of flaky.

This patch changes the behavior of useTracker and withTracker enough, that I think it should get a minor version bump if this patch is accepted. (This patch is also wrapped in to the typescript conversion.)