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): check state chage via deep compare #1558

Merged
merged 5 commits into from
Dec 28, 2023

Conversation

silviuaavram
Copy link
Collaborator

@silviuaavram silviuaavram commented Nov 13, 2023

What:
Deep compare the previous state with the next state.

Why:
Avoid unnecessary calls of onChange props.
Fixes #1534.
Fixes #1540.
Fixes #1511.
Fixes #1447.

How:
Check each property from state instead of using referential comparison of the whole state object.

Checklist:

  • Documentation
  • Tests
  • TypeScript Types
  • Flow Types
  • Ready to be merged

@danichim
Copy link

@silviuaavram Can you please update to pass checks and merge it ?

@silviuaavram
Copy link
Collaborator Author

silviuaavram commented Dec 28, 2023

@danichim this fix is not enough unfortunately, I tried publishing an alpha 8.2.4-alpha.3 with the fix and checked a repro sandbox, still broken ...

https://codesandbox.io/p/sandbox/react-v8-formik-downshift-forked-mfjk4y?file=%2Fpackage.json%3A8%2C24

I am currently still looking into it

@silviuaavram
Copy link
Collaborator Author

Got it. It's formik, they had to fix something in 2.4.2 as part of React 18.

Will update this PR to get a green build, and will update accordingly all our issues. Thanks!

@silviuaavram silviuaavram merged commit 4edfc30 into master Dec 28, 2023
2 checks passed
@silviuaavram silviuaavram deleted the fix/deep-check-state-change branch December 28, 2023 10:11
Copy link

🎉 This PR is included in version 8.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@danichim
Copy link

danichim commented Jan 4, 2024

image
Chrome browser with v8.2.4 downshifts only in responsive mobile mode.
Can you help me to solve this issue @silviuaavram ?

@silviuaavram
Copy link
Collaborator Author

@danichim this ticket has been fixed, tested and closed. If you still have any other issue please create a new ticket with a repro guide and a codesandbox to repro the issue. thanks!

@danichim
Copy link

danichim commented Jan 4, 2024

@danichim this ticket has been fixed, tested and closed. If you still have any other issue please create a new ticket with a repro guide and a codesandbox to repro the issue. thanks!

Thanks @silviuaavram for your time, #1564 is my issue. Have a nice day !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants