Files
Basilosaurusrex f027651f9b main repo
2025-11-24 18:09:40 +01:00

43 lines
2.0 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "applyFlightData", {
enumerable: true,
get: function() {
return applyFlightData;
}
});
const _approutercontextsharedruntime = require("../../../shared/lib/app-router-context.shared-runtime");
const _filllazyitemstillleafwithhead = require("./fill-lazy-items-till-leaf-with-head");
const _fillcachewithnewsubtreedata = require("./fill-cache-with-new-subtree-data");
function applyFlightData(existingCache, cache, flightDataPath, wasPrefetched) {
if (wasPrefetched === void 0) wasPrefetched = false;
// The one before last item is the router state tree patch
const [treePatch, subTreeData, head] = flightDataPath.slice(-3);
// Handles case where prefetch only returns the router tree patch without rendered components.
if (subTreeData === null) {
return false;
}
if (flightDataPath.length === 3) {
cache.status = _approutercontextsharedruntime.CacheStates.READY;
cache.subTreeData = subTreeData;
(0, _filllazyitemstillleafwithhead.fillLazyItemsTillLeafWithHead)(cache, existingCache, treePatch, head, wasPrefetched);
} else {
// Copy subTreeData for the root node of the cache.
cache.status = _approutercontextsharedruntime.CacheStates.READY;
cache.subTreeData = existingCache.subTreeData;
cache.parallelRoutes = new Map(existingCache.parallelRoutes);
// Create a copy of the existing cache with the subTreeData applied.
(0, _fillcachewithnewsubtreedata.fillCacheWithNewSubTreeData)(cache, existingCache, flightDataPath, wasPrefetched);
}
return true;
}
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=apply-flight-data.js.map