meteor / react-packages

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

Fix useTrackerNoDeps for React 18 #359

Closed CaptainN closed 2 years ago

CaptainN commented 2 years ago

Fixes useTrackerNoDeps for React 18

Also re-adds an attempt to retain the "side-effect" we are creating during first render, when we can, to both versions of the hook

The tests don't work with react 18 because the testing framework requires updating, and that breaks things. It's important to get those tests working again before we ship this, because they test important edge cases.

CaptainN commented 2 years ago

I actually fixed the tests for the old version of react, and am satisfied that if those are working for react, and some less automated tests show this works for React 18, then we should ship this without waiting for testing rework.

This should be good to go.

denihs commented 2 years ago

react-meteor-data@2.5.0 published!

bratelefant commented 2 years ago

Had an issue after updating to 2.5.0 on react 16.13.1 (usual Invalid hook call. Hooks can only be called inside the body of a function component); downgrading react-meteor-data to 2.4.0 solved it. Can't really come up with a minimal reproduction of this issue, but stack trace showed that the error originated in useTracker.ts line 69 const data = reactiveFn(c); in the Tracker.nonreactive function.