meteor / react-packages

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

Fix useFind if cursor has no value #374

Closed piotrpospiech closed 1 year ago

piotrpospiech commented 2 years ago

I fixed the behavior of useFind to pass a test in a useFind.tests.js.

const docs = useFind(() => returnNull ? null : TestDocs.find(), [returnNull])
  1. useFind can accept () => null as argument. Previously it returned null in this scenario, so I changed the return statement because it was returning an empty array.

  2. I also added setting the didMount flag before checking if the cursor is null or undefined. Without this, example above will return an empty array if returnNull will change to false

Grubba27 commented 1 year ago

Thx as it changes some of its behavior I will launch this change in 2.6.0

Grubba27 commented 1 year ago

ppublished

radekmie commented 1 year ago

No, it actualy restores the one that got accidentally removed in the previous release.