Open m417z opened 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/shizukuichi/winXP/AwLsNmPBA6QutX2DU9Uxf3jguHPk
✅ Preview: https://winxp-git-fork-m417z-patch-2-shizukuichi.vercel.app
The problem was that a new
onIconsSelected
function was created on each render, causing the following infinite loop:WinXP()
is called.onIconsSelected
function is passed to<Icons />
.useEffect
is called insideIcons()
, andsetSelectedIcons
is called.setSelectedIcons
triggers a dispatch, causingWinXP()
to be called again.To fix this, I wrapped
setSelectedIcons
withuseCallback
. And while at it, I wrapped all other functions.