// 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.
// @ts-expect-error TODO-APP: handle changing of the type
childNodes.set(path,{
childNode.status=CacheStates.READY
data:null,
// @ts-expect-error TODO-APP: handle changing of the type
subTreeData:childProp.current,
childNode.subTreeData=childProp.current
parallelRoutes:newMap(),
// 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
// Mutates the prop in order to clean up the memory associated with the subTreeData as it is now part of the cache.
}else{
childProp.current=null
// Add the segment's subTreeData to the cache.
// In the above case childNode was set on childNodes, so we have to get it from the cacheNodes again.
// 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.
childNode=childNodes.get(path)
childNodes.set(path,{
status:CacheStates.READY,
data:null,
subTreeData:childProp.current,
parallelRoutes:newMap(),
})
// 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
// In the above case childNode was set on childNodes, so we have to get it from the cacheNodes again.
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.
...
@@ -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.