42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "findHeadInCache", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return findHeadInCache;
|
|
}
|
|
});
|
|
const _createroutercachekey = require("../create-router-cache-key");
|
|
function findHeadInCache(cache, parallelRoutes) {
|
|
const isLastItem = Object.keys(parallelRoutes).length === 0;
|
|
if (isLastItem) {
|
|
return cache.head;
|
|
}
|
|
for(const key in parallelRoutes){
|
|
const [segment, childParallelRoutes] = parallelRoutes[key];
|
|
const childSegmentMap = cache.parallelRoutes.get(key);
|
|
if (!childSegmentMap) {
|
|
continue;
|
|
}
|
|
const cacheKey = (0, _createroutercachekey.createRouterCacheKey)(segment);
|
|
const cacheNode = childSegmentMap.get(cacheKey);
|
|
if (!cacheNode) {
|
|
continue;
|
|
}
|
|
const item = findHeadInCache(cacheNode, childParallelRoutes);
|
|
if (item) {
|
|
return item;
|
|
}
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
|
Object.defineProperty(exports.default, '__esModule', { value: true });
|
|
Object.assign(exports.default, exports);
|
|
module.exports = exports.default;
|
|
}
|
|
|
|
//# sourceMappingURL=find-head-in-cache.js.map
|