-
Notifications
You must be signed in to change notification settings - Fork 84
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
useDeepCompareEffect() not working as expected #64
Comments
In my case the hook stops compare properly after the first successful comparison. I created a ref externally to that hook, and passed the ref through method calls. In this case the ref keeps a previous value. For me it looks like a very strange behavior of UPD It does not matter whether the dependencies are memoized or not. The original useDeepCompare from |
In my case the hook stops compare properly after the first successful comparison. |
I am having a similar issue while depending on the value from the https://codesandbox.io/s/modest-scooby-zpn2c7?file=/src/App.js Modifying the input value does not seem to trigger the effect more than once. Any idea as to why? E: I found this in the hook form docs:
I'm guessing hook-form is the issue rather than this lib E2: I was able to resolve this by using a slightly modified version of this library which does a |
use-deep-compare-effect
version: ^1.8.1node
version: v18.11.0npm
version: 8.19.2Relevant code or config
What you did:
I implement the
useDeepCompareEffect()
instead of the nativeuseEffect()
hook.Problem description:
The
useDeepCompareEffect()
is not executing, when the object is updated. This oneis part of an offline first database (watermelonDB) and updates
arrayWithDeeplyNestedObjects
when there is a change in the database. I would expectuseDeepCompareEffect()
to execute, wheneverarrayWithDeeplyNestedObjects
changes, but it is not.This is how
arrayWithDeeplyNestedObjects
looks likeThe changes to
arrayWithDeeplyNestedObjects
are done in the objects either tox
,y
orid_arr
. The length ofarrayWithDeeplyNestedObjects
can change as well. There might be more (or less) objects of the same structure in there.Why isn't
useDeepCompareEffect()
executed, whenarrayWithDeeplyNestedObjects
changes?The text was updated successfully, but these errors were encountered: