Hook is not triggered when boolean property changed on nested object.
See original GitHub issueuse-deep-compare-effect
version:1.3.0node
version: 12.9.1npm
(oryarn
) version: 6.4.1
What you did: Passed an object (nested) as prop to a functional component
What happened: One of the nested properties of the object is changed from false/true.
Problem description: useDeepEffect is not triggered when object changed.
Suggested solution: the only way I manage to achieve what I wanted is to by doing: JSON.stringify(nestedObject)
Object Structure:
nestedObject: {
a: {another obj},
array: [
{b: Boolean},
{c: Boolean},
{d: Boolean},
]
}
Problem: Boolean ‘C’ changed, but useDeepEffect is not triggered.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
React hook toggle bool value on nested property
I create an initial state with a boolean for whether the modal will show or not, and an additional property to pass in...
Read more >TIL: You can watch for nested properties changing in React's ...
Today I learned: you can watch for nested properties changing in React's useEffect() hook by using dot notation in the dependency array, ...
Read more >SyntheticEvent - React
React normalizes events so that they have consistent properties across different browsers. The event handlers below are triggered by an event in the...
Read more >Reactivity Fundamentals - Vue.js
However, properties added this way will not be able to trigger reactive updates. ... changes to be detected even when you mutate nested...
Read more >renderedCallback() in Lightning Web Component
A lifecycle hook is a callback method triggered at a specific phase ... is do not use renderedCallback() to change the state of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@trentonsnyder That sandbox is setting a new object reference on button click so it seems like it is working correctly. Here’s an actual reproduction of the bug: https://codesandbox.io/s/restless-star-c175j
Ok, this sums it up, I think. Intentionally not supported and it makes sense.