Fixed `null is not an object (evaluating 't.parallelRoutes.get')` (#75360)
### Related issues 1. Fixes #69272 2. Fixes #69270 3. Fixes #67730 4. Relates to https://github.com/vercel/next.js/issues/55462#issuecomment-1896098700 5. Resolves https://github.com/vercel/next.js/discussions/67729 6. Relates to https://github.com/vercel/next.js/discussions/66752 ### What? Quite often we are getting `TypeError: null is not an object (evaluating 't.parallelRoutes.get')` error in our error tracker. There is no clear pattern; but it's daily count grows as DAU amount grows. Error call trace is: ``` router-reducer/fill-lazy-items-till-leaf-with-head.ts at line 153:59 router-reducer/create-initial-router-state.ts at line 66:34 ``` ### Why? In the code there is comment `location and initialParallelRoutes are not initialized in the SSR render they are set to an empty map and window.location, respectively during hydration`. However, it seems that it's not always set to an empty map on the client side. ### How? To ensure it's always set, I have replaced wrong (from ts pov) `null!` with `new Map()` and redundant logic of passing `initialParallelRoutes` into `cache.parallelRoutes`
Showing
Please
register
or
sign in
to comment