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: hooks cause infinite rerender #31

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

Boffee
Copy link
Contributor

@Boffee Boffee commented Oct 20, 2023

the react blinkdb hooks causes there callers to rerender infinitely because the useEffect in useMany watches the query argument, which is a new object instance every time the caller rerenders.

A simple solution is to stringify the query in useEffect.

@netlify
Copy link

netlify bot commented Oct 20, 2023

Deploy Preview for blinkdb canceled.

Name Link
🔨 Latest commit 821a44b
🔍 Latest deploy log https://app.netlify.com/sites/blinkdb/deploys/6532f2e3560e43000832c241

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Merging #31 (821a44b) into main (6658a7d) will decrease coverage by 0.01%.
Report is 5 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
- Coverage   95.15%   95.14%   -0.01%     
==========================================
  Files          74       74              
  Lines        1136     1134       -2     
  Branches      263      262       -1     
==========================================
- Hits         1081     1079       -2     
  Misses         55       55              
Files Coverage Δ
packages/db/src/core/remove.ts 88.88% <100.00%> (ø)
packages/db/src/core/removeMany.ts 100.00% <100.00%> (ø)
packages/react/src/retrieval/useMany.ts 100.00% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@maradotwebp
Copy link
Contributor

Thanks for the fix!

@maradotwebp maradotwebp merged commit 665d592 into blinkdb-js:main Oct 21, 2023
7 checks passed
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