Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
57
node_modules/next/dist/client/components/router-reducer/reducers/prefetch-reducer.js
generated
vendored
Normal file
57
node_modules/next/dist/client/components/router-reducer/reducers/prefetch-reducer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
prefetchQueue: null,
|
||||
prefetchReducer: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
prefetchQueue: function() {
|
||||
return prefetchQueue;
|
||||
},
|
||||
prefetchReducer: function() {
|
||||
return prefetchReducer;
|
||||
}
|
||||
});
|
||||
const _promisequeue = require("../../promise-queue");
|
||||
const _prefetchcacheutils = require("../prefetch-cache-utils");
|
||||
const prefetchQueue = new _promisequeue.PromiseQueue(5);
|
||||
const prefetchReducer = process.env.__NEXT_CLIENT_SEGMENT_CACHE ? identityReducerWhenSegmentCacheIsEnabled : prefetchReducerImpl;
|
||||
function identityReducerWhenSegmentCacheIsEnabled(state) {
|
||||
// Unlike the old implementation, the Segment Cache doesn't store its data in
|
||||
// the router reducer state.
|
||||
//
|
||||
// This shouldn't be reachable because we wrap the prefetch API in a check,
|
||||
// too, which prevents the action from being dispatched. But it's here for
|
||||
// clarity + code elimination.
|
||||
return state;
|
||||
}
|
||||
function prefetchReducerImpl(state, action) {
|
||||
// let's prune the prefetch cache before we do anything else
|
||||
(0, _prefetchcacheutils.prunePrefetchCache)(state.prefetchCache);
|
||||
const { url } = action;
|
||||
(0, _prefetchcacheutils.getOrCreatePrefetchCacheEntry)({
|
||||
url,
|
||||
nextUrl: state.nextUrl,
|
||||
prefetchCache: state.prefetchCache,
|
||||
kind: action.kind,
|
||||
tree: state.tree,
|
||||
allowAliasing: true
|
||||
});
|
||||
return state;
|
||||
}
|
||||
|
||||
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=prefetch-reducer.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue