Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Resolved conflicts by taking GitHub versions for: - .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml Kept deploy.sh updated to: - Pull from GitHub (primary source) - Push to Gitea (push-mirror) - Build from site/ directory (GitHub structure) Co-Authored-By: Paperclip <noreply@paperclip.ing>
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
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
|