You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Warning: The final argument passed to useEffect changed size between renders. The order and size of this array must remain constant." appears so many times in my project.
The tech stack I am using are: React.lazy + react-hot-loader + React Router + idb-keyval.
Here's the project I have: A hash router to maintain multple pages. Each page component is a dynamic component created by React.lazy. There's a component providing tab links on top of the Router. The component also use idb-keyval library to access cache from indexedDB.
Problem: If I use any methods or features of react-hot-loader inside the page component, like hot, setConfig. The error above would be thrown.
I know this may not be the best practice for react-hot-loader (README.md said using hot or setConfig at the very beginning or before React). Just curious how this happens. I also dig into the code base and found the wrappedHook function:
constwrappedHook=function(cb,deps){if(configuration.reloadHooks&&deps){constinputs=[...deps];// reload hooks which have changed string representationif(configuration.reloadHooksOnBodyChange){inputs.push(String(cb));}if(// reload hooks with dependenciesdeps.length>0||// reload all hooks of option is set(configuration.reloadLifeCycleHooks&&deps.length===0)){inputs.push(getHotGeneration());}returnhook(cb,inputs);}returnhook(cb,deps);};
Seems this is related to the warning I have? If that so, would it potentially validate the "changing deps array size" rule of React?
The code base is so large to me. So, that's how far I got. 😢 Can anyone help me with this? Thx.
A minimum reproducible demo is below.
Expected behavior
No warning.
Actual behavior
What actually happens:
"Warning: The final argument passed to useEffect changed size between renders. The order and size of this array must remain constant."
Environment
React Hot Loader version: ^4.13.0
Run these commands in the project folder and fill in their results:
node -v:v12.16.3
npm -v:6.14.4
Then, specify:
Operating system: Mac OS Big Sur 11.2.2
Browser and version:
Reproducible Demo
Here's the minimum reproducible demo on my github:
Description
"Warning: The final argument passed to useEffect changed size between renders. The order and size of this array must remain constant." appears so many times in my project.
The tech stack I am using are: React.lazy + react-hot-loader + React Router + idb-keyval.
Here's the project I have: A hash router to maintain multple pages. Each page component is a dynamic component created by
React.lazy
. There's a component providing tab links on top of the Router. The component also useidb-keyval
library to access cache from indexedDB.Problem: If I use any methods or features of
react-hot-loader
inside the page component, likehot
,setConfig
. The error above would be thrown.I know this may not be the best practice for react-hot-loader (README.md said using
hot
orsetConfig
at the very beginning or before React). Just curious how this happens. I also dig into the code base and found thewrappedHook
function:Seems this is related to the warning I have? If that so, would it potentially validate the "changing deps array size" rule of React?
The code base is so large to me. So, that's how far I got. 😢 Can anyone help me with this? Thx.
A minimum reproducible demo is below.
Expected behavior
No warning.
Actual behavior
What actually happens:
"Warning: The final argument passed to useEffect changed size between renders. The order and size of this array must remain constant."
Environment
React Hot Loader version: ^4.13.0
Run these commands in the project folder and fill in their results:
node -v
:v12.16.3npm -v
:6.14.4Then, specify:
Reproducible Demo
Here's the minimum reproducible demo on my github:
https://github.com/Haixiang6123/react-hot-loader-error
The text was updated successfully, but these errors were encountered: