mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 22:05:20 +00:00
handle skipped segments
This commit is contained in:
@@ -288,14 +288,22 @@ export async function hydrate_target(target: Target): Promise<{
|
|||||||
let l = 1;
|
let l = 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
let segment_dirty = false;
|
||||||
branch = await Promise.all(route.parts.map(async (part, i) => {
|
branch = await Promise.all(route.parts.map(async (part, i) => {
|
||||||
|
const segment = segments[i];
|
||||||
|
|
||||||
|
if (current_branch[i] && current_branch[i].segment !== segment) segment_dirty = true;
|
||||||
|
|
||||||
props.segments[l] = segments[i + 1]; // TODO make this less confusing
|
props.segments[l] = segments[i + 1]; // TODO make this less confusing
|
||||||
if (!part) return null;
|
if (!part) return { segment };
|
||||||
|
|
||||||
const j = l++;
|
const j = l++;
|
||||||
|
|
||||||
const segment = segments[i];
|
if (!session_dirty && !segment_dirty && current_branch[i] && current_branch[i].part === part.i) {
|
||||||
if (!session_dirty && current_branch[i] && current_branch[i].segment === segment && current_branch[i].part === part.i) return current_branch[i];
|
return current_branch[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
segment_dirty = false;
|
||||||
|
|
||||||
const { default: component, preload } = await load_component(components[part.i]);
|
const { default: component, preload } = await load_component(components[part.i]);
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,4 @@
|
|||||||
|
|
||||||
<h1>{one}:{two}</h1>
|
<h1>{one}:{two}</h1>
|
||||||
|
|
||||||
<a href="y/1">y/1</a>
|
<a href="skipped/y/1">skipped/y/1</a>
|
||||||
Reference in New Issue
Block a user