// @ts-expect-error TODO-APP: handle changing of the type
childNode.status=CacheStates.READY
// @ts-expect-error TODO-APP: handle changing of the type
childNode.subTreeData=childProp.current
// Mutates the prop in order to clean up the memory associated with the subTreeData as it is now part of the cache.
childProp.current=null
}else{
// Add the segment's subTreeData to the cache.
// Add the segment's subTreeData to the cache.
// This writes to the cache when there is no item in the cache yet. It never *overwrites* existing cache items which is why it's safe in concurrent mode.
// This writes to the cache when there is no item in the cache yet. It never *overwrites* existing cache items which is why it's safe in concurrent mode.
childNodes.set(path,{
childNodes.set(path,{
status:CacheStates.READY,
data:null,
data:null,
subTreeData:childProp.current,
subTreeData:childProp.current,
parallelRoutes:newMap(),
parallelRoutes:newMap(),
...
@@ -159,6 +167,7 @@ export function InnerLayoutRouter({
...
@@ -159,6 +167,7 @@ export function InnerLayoutRouter({
// In the above case childNode was set on childNodes, so we have to get it from the cacheNodes again.
// In the above case childNode was set on childNodes, so we have to get it from the cacheNodes again.
childNode=childNodes.get(path)
childNode=childNodes.get(path)
}
}
}
// When childNode is not available during rendering client-side we need to fetch it from the server.
// When childNode is not available during rendering client-side we need to fetch it from the server.
if(!childNode){
if(!childNode){
...
@@ -172,6 +181,7 @@ export function InnerLayoutRouter({
...
@@ -172,6 +181,7 @@ export function InnerLayoutRouter({
* Flight data fetch kicked off during render and put into the cache.
* Flight data fetch kicked off during render and put into the cache.