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
I've noticed some server logs with the following error:
TypeError: Cannot read properties of undefined (reading 'length')
at areHookInputsEqual (/var/app/current/node_modules/react-ssr-prepass/dist/react-ssr-prepass.js:295:29)
at Object.useMemo (/var/app/current/node_modules/react-ssr-prepass/dist/react-ssr-prepass.js:301:6)
Looking at the function, it appears there's no guard/check that prevDeps may be undefined?
function areHookInputsEqual(
nextDeps: Array<mixed>,
prevDeps: Array<mixed> | null
) {
// NOTE: The warnings that are used in ReactPartialRendererHooks are obsolete
// in a prepass, since these issues will be caught by a subsequent renderer anyway
if (prevDeps === null) return false
for (let i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
if (!is(nextDeps[i], prevDeps[i])) return false
}
return true
}
I just wanted to highlight it as a potential issue. I'm not sure if it's implementation problem my end that's causing prevDeps to be undefined (rather than null)?
But just in case - in normal use - prevDeps can be undefined perhaps there should be a guard/check in place to protect against this? Could the check just be if (!prevDeps) return false instead?
The text was updated successfully, but these errors were encountered:
Hi,
I've noticed some server logs with the following error:
Looking at the function, it appears there's no guard/check that prevDeps may be undefined?
I just wanted to highlight it as a potential issue. I'm not sure if it's implementation problem my end that's causing
prevDeps
to be undefined (rather than null)?But just in case - in normal use -
prevDeps
can be undefined perhaps there should be a guard/check in place to protect against this? Could the check just beif (!prevDeps) return false
instead?The text was updated successfully, but these errors were encountered: