Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
24
node_modules/next/dist/esm/client/components/router-reducer/should-hard-navigate.js
generated
vendored
Normal file
24
node_modules/next/dist/esm/client/components/router-reducer/should-hard-navigate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { getNextFlightSegmentPath } from '../../flight-data-helpers';
|
||||
import { matchSegment } from '../match-segments';
|
||||
// TODO-APP: flightSegmentPath will be empty in case of static response, needs to be handled.
|
||||
export function shouldHardNavigate(flightSegmentPath, flightRouterState) {
|
||||
const [segment, parallelRoutes] = flightRouterState;
|
||||
// TODO-APP: Check if `as` can be replaced.
|
||||
const [currentSegment, parallelRouteKey] = flightSegmentPath;
|
||||
// Check if current segment matches the existing segment.
|
||||
if (!matchSegment(currentSegment, segment)) {
|
||||
// If dynamic parameter in tree doesn't match up with segment path a hard navigation is triggered.
|
||||
if (Array.isArray(currentSegment)) {
|
||||
return true;
|
||||
}
|
||||
// If the existing segment did not match soft navigation is triggered.
|
||||
return false;
|
||||
}
|
||||
const lastSegment = flightSegmentPath.length <= 2;
|
||||
if (lastSegment) {
|
||||
return false;
|
||||
}
|
||||
return shouldHardNavigate(getNextFlightSegmentPath(flightSegmentPath), parallelRoutes[parallelRouteKey]);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=should-hard-navigate.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue