[FIX] error occurring in useEffect on hmr/strict mode - #308
[FIX] error occurring in useEffect on hmr/strict mode#308PatrykWalach wants to merge 28 commits into
useEffect on hmr/strict mode#308Conversation
9b897fd to
e9d1845
Compare
rbalicki2
left a comment
There was a problem hiding this comment.
lgtm, just rewrote the comment slightly for grammar and clarity
rbalicki2
left a comment
There was a problem hiding this comment.
Sorry, I forgot to do a thorough review before accepting 😂 Do we also need this in useUpdatableDisposableState?
If so, there are probably enough places where we do this that it makes sense to have a useEffectIgnoringHmrAndStrictMode hook.
It might return the lastCommittedParentCache, in which case we don't need to do anything extra in useCachedResponsivePreCommitValue
|
The solution used here is not good
so we end up in a cleaned-up state The reason it doesn't cause any issues now is probably because of |
|
Ah yeah, you're totally right. Good call re: gcBuffer. I'm going to think about this. I wonder if we need to try to detect HMR/double mounting more directly. |
|
on This is not tested. It might be easier to test after merging the second pull request. |
d3de5d4 to
50f95ea
Compare
|
Now the cycle is
so at the end we are in the populated state. we don't need to set
|
4816616 to
edeac96
Compare
useEffect on hmruseEffect on hmr/strict mode
| undisposedICIs.current.delete(undisposedICI); | ||
| undisposedICI.cleanup(); | ||
| } | ||
| setStateICI(UNASSIGNED_STATE); |
There was a problem hiding this comment.
I think it's fair to set this to UNASSIGNED_STATE to prevent mutations from firing twice. This was the last piece preventing this PR from being merged @rbalicki2 let me know what you think
e2dd51a to
50bc00f
Compare
…t `useLazyDisposable`
50bc00f to
c8e6a67
Compare
useEffect on hmr/strict modeuseEffect on hmr/strict mode
useEffect on hmr/strict modeuseEffect on hmr/strict mode
This PR fixes runtime errors thrown during hmr/strict mode.
This on it's own is not enough to make hmr work. Hast to be merged locally with #306 to test hmr.
Rebase of #264