Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix useFind if cursor has no value #374

Merged
merged 1 commit into from
Nov 28, 2022
Merged

Fix useFind if cursor has no value #374

merged 1 commit into from
Nov 28, 2022

Conversation

piotrpospiech
Copy link
Contributor

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

@piotrpospiech piotrpospiech self-assigned this Nov 28, 2022
@Grubba27
Copy link
Contributor

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

@Grubba27 Grubba27 merged commit 91422a8 into master Nov 28, 2022
@Grubba27
Copy link
Contributor

ppublished

@radekmie
Copy link
Collaborator

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

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.

4 participants