/
opt
/
canhelp
/
node_modules
/
next
/
dist
/
client
/
components
/
router-reducer
/
/opt/canhelp/node_modules/next/dist/client/components/router-reducer
mkdir
upload
Name
Size
Mode
Actions
reducers/
-
0755
rm
aliased-prefetch-navigations.d.ts
1582
0644
edit
dl
rm
aliased-prefetch-navigations.js
9307
0644
edit
dl
rm
aliased-prefetch-navigations.js.map
14706
0644
edit
dl
rm
apply-flight-data.d.ts
410
0644
edit
dl
rm
apply-flight-data.js
2510
0644
edit
dl
rm
apply-flight-data.js.map
3434
0644
edit
dl
rm
apply-router-state-patch-to-tree.d.ts
554
0644
edit
dl
rm
apply-router-state-patch-to-tree.js
4215
0644
edit
dl
rm
apply-router-state-patch-to-tree.js.map
6515
0644
edit
dl
rm
clear-cache-node-data-for-segment-path.d.ts
456
0644
edit
dl
rm
clear-cache-node-data-for-segment-path.js
3362
0644
edit
dl
rm
clear-cache-node-data-for-segment-path.js.map
4734
0644
edit
dl
rm
compute-changed-path.d.ts
539
0644
edit
dl
rm
compute-changed-path.js
5572
0644
edit
dl
rm
compute-changed-path.js.map
8405
0644
edit
dl
rm
create-href-from-url.d.ts
122
0644
edit
dl
rm
create-href-from-url.js
767
0644
edit
dl
rm
create-href-from-url.js.map
601
0644
edit
dl
rm
create-initial-router-state.d.ts
1323
0644
edit
dl
rm
create-initial-router-state.js
6472
0644
edit
dl
rm
create-initial-router-state.js.map
9152
0644
edit
dl
rm
create-router-cache-key.d.ts
172
0644
edit
dl
rm
create-router-cache-key.js
1397
0644
edit
dl
rm
create-router-cache-key.js.map
1430
0644
edit
dl
rm
fetch-server-response.d.ts
1947
0644
edit
dl
rm
fetch-server-response.js
14742
0644
edit
dl
rm
fetch-server-response.js.map
23366
0644
edit
dl
rm
fill-cache-with-new-subtree-data.d.ts
688
0644
edit
dl
rm
fill-cache-with-new-subtree-data.js
5412
0644
edit
dl
rm
fill-cache-with-new-subtree-data.js.map
8359
0644
edit
dl
rm
fill-lazy-items-till-leaf-with-head.d.ts
536
0644
edit
dl
rm
fill-lazy-items-till-leaf-with-head.js
7466
0644
edit
dl
rm
fill-lazy-items-till-leaf-with-head.js.map
9794
0644
edit
dl
rm
handle-mutable.d.ts
191
0644
edit
dl
rm
handle-mutable.js
3446
0644
edit
dl
rm
handle-mutable.js.map
5390
0644
edit
dl
rm
handle-segment-mismatch.d.ts
536
0644
edit
dl
rm
handle-segment-mismatch.js
1237
0644
edit
dl
rm
handle-segment-mismatch.js.map
1803
0644
edit
dl
rm
invalidate-cache-below-flight-segmentpath.d.ts
411
0644
edit
dl
rm
invalidate-cache-below-flight-segmentpath.js
2789
0644
edit
dl
rm
invalidate-cache-below-flight-segmentpath.js.map
3909
0644
edit
dl
rm
invalidate-cache-by-router-state.d.ts
368
0644
edit
dl
rm
invalidate-cache-by-router-state.js
1427
0644
edit
dl
rm
invalidate-cache-by-router-state.js.map
1864
0644
edit
dl
rm
is-navigating-to-new-root-layout.d.ts
198
0644
edit
dl
rm
is-navigating-to-new-root-layout.js
2473
0644
edit
dl
rm
is-navigating-to-new-root-layout.js.map
3121
0644
edit
dl
rm
ppr-navigations.d.ts
1379
0644
edit
dl
rm
ppr-navigations.js
44689
0644
edit
dl
rm
ppr-navigations.js.map
70696
0644
edit
dl
rm
prefetch-cache-utils.d.ts
1895
0644
edit
dl
rm
prefetch-cache-utils.js
15958
0644
edit
dl
rm
prefetch-cache-utils.js.map
22805
0644
edit
dl
rm
refetch-inactive-parallel-segments.d.ts
1886
0644
edit
dl
rm
refetch-inactive-parallel-segments.js
4927
0644
edit
dl
rm
refetch-inactive-parallel-segments.js.map
7911
0644
edit
dl
rm
router-reducer-types.d.ts
9140
0644
edit
dl
rm
router-reducer-types.js
2414
0644
edit
dl
rm
router-reducer-types.js.map
9828
0644
edit
dl
rm
router-reducer.d.ts
261
0644
edit
dl
rm
router-reducer.js
2787
0644
edit
dl
rm
router-reducer.js.map
3310
0644
edit
dl
rm
set-cache-busting-search-param.d.ts
1543
0644
edit
dl
rm
set-cache-busting-search-param.js
2910
0644
edit
dl
rm
set-cache-busting-search-param.js.map
4791
0644
edit
dl
rm
should-hard-navigate.d.ts
217
0644
edit
dl
rm
should-hard-navigate.js
1623
0644
edit
dl
rm
should-hard-navigate.js.map
2092
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js
(6472B)
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "createInitialRouterState", { enumerable: true, get: function() { return createInitialRouterState; } }); const _createhreffromurl = require("./create-href-from-url"); const _filllazyitemstillleafwithhead = require("./fill-lazy-items-till-leaf-with-head"); const _computechangedpath = require("./compute-changed-path"); const _prefetchcacheutils = require("./prefetch-cache-utils"); const _routerreducertypes = require("./router-reducer-types"); const _refetchinactiveparallelsegments = require("./refetch-inactive-parallel-segments"); const _flightdatahelpers = require("../../flight-data-helpers"); function createInitialRouterState(param) { let { navigatedAt, initialFlightData, initialCanonicalUrlParts, initialParallelRoutes, location, couldBeIntercepted, postponed, prerendered } = param; // When initialized on the server, the canonical URL is provided as an array of parts. // This is to ensure that when the RSC payload streamed to the client, crawlers don't interpret it // as a URL that should be crawled. const initialCanonicalUrl = initialCanonicalUrlParts.join('/'); const normalizedFlightData = (0, _flightdatahelpers.getFlightDataPartsFromPath)(initialFlightData[0]); const { tree: initialTree, seedData: initialSeedData, head: initialHead } = normalizedFlightData; // For the SSR render, seed data should always be available (we only send back a `null` response // in the case of a `loading` segment, pre-PPR.) const rsc = initialSeedData == null ? void 0 : initialSeedData[1]; var _initialSeedData_; const loading = (_initialSeedData_ = initialSeedData == null ? void 0 : initialSeedData[3]) != null ? _initialSeedData_ : null; const cache = { lazyData: null, rsc, prefetchRsc: null, head: null, prefetchHead: null, // The cache gets seeded during the first render. `initialParallelRoutes` ensures the cache from the first render is there during the second render. parallelRoutes: initialParallelRoutes, loading, navigatedAt }; const canonicalUrl = // location.href is read as the initial value for canonicalUrl in the browser // This is safe to do as canonicalUrl can't be rendered, it's only used to control the history updates in the useEffect further down in this file. location ? (0, _createhreffromurl.createHrefFromUrl)(location) : initialCanonicalUrl; (0, _refetchinactiveparallelsegments.addRefreshMarkerToActiveParallelSegments)(initialTree, canonicalUrl); const prefetchCache = new Map(); // When the cache hasn't been seeded yet we fill the cache with the head. if (initialParallelRoutes === null || initialParallelRoutes.size === 0) { (0, _filllazyitemstillleafwithhead.fillLazyItemsTillLeafWithHead)(navigatedAt, cache, undefined, initialTree, initialSeedData, initialHead, undefined); } var // the || operator is intentional, the pathname can be an empty string _ref; const initialState = { tree: initialTree, cache, prefetchCache, pushRef: { pendingPush: false, mpaNavigation: false, // First render needs to preserve the previous window.history.state // to avoid it being overwritten on navigation back/forward with MPA Navigation. preserveCustomHistoryState: true }, focusAndScrollRef: { apply: false, onlyHashChange: false, hashFragment: null, segmentPaths: [] }, canonicalUrl, nextUrl: (_ref = (0, _computechangedpath.extractPathFromFlightRouterState)(initialTree) || (location == null ? void 0 : location.pathname)) != null ? _ref : null }; if (process.env.NODE_ENV !== 'development' && location) { // Seed the prefetch cache with this page's data. // This is to prevent needlessly re-prefetching a page that is already reusable, // and will avoid triggering a loading state/data fetch stall when navigating back to the page. // We don't currently do this in development because links aren't prefetched in development // so having a mismatch between prefetch/no prefetch provides inconsistent behavior based on which page // was loaded first. const url = new URL("" + location.pathname + location.search, location.origin); (0, _prefetchcacheutils.createSeededPrefetchCacheEntry)({ url, data: { flightData: [ normalizedFlightData ], canonicalUrl: undefined, couldBeIntercepted: !!couldBeIntercepted, prerendered, postponed, // TODO: The initial RSC payload includes both static and dynamic data // in the same response, even if PPR is enabled. So if there's any // dynamic data at all, we can't set a stale time. In the future we may // add a way to split a single Flight stream into static and dynamic // parts. But in the meantime we should at least make this work for // fully static pages. staleTime: // In the old router, there was only a single configurable staleTime (experimental.staleTimes) // As an abundance of caution, this will only set the initial staleTime to the configured value // if we're not leveraging the segment cache, which has its own prefetching semantics. prerendered && !process.env.__NEXT_CLIENT_SEGMENT_CACHE ? _prefetchcacheutils.STATIC_STALETIME_MS : -1 }, tree: initialState.tree, prefetchCache: initialState.prefetchCache, nextUrl: initialState.nextUrl, kind: prerendered ? _routerreducertypes.PrefetchKind.FULL : _routerreducertypes.PrefetchKind.AUTO }); } return initialState; } 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=create-initial-router-state.js.map
Save
cmd:
run