mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-19 22:05:20 +00:00
Merge pull request #314 from sveltejs/fix-child-segment
fix child.segment bug
This commit is contained in:
@@ -233,7 +233,7 @@ function prepare_page(target: Target): Promise<{
|
|||||||
path,
|
path,
|
||||||
preloading: false,
|
preloading: false,
|
||||||
child: Object.assign({}, root_props.child, {
|
child: Object.assign({}, root_props.child, {
|
||||||
segment: new_segments[0]
|
segment: segments[0]
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
if (changed(query, root_props.query)) data.query = query;
|
if (changed(query, root_props.query)) data.query = query;
|
||||||
@@ -260,12 +260,11 @@ function prepare_page(target: Target): Promise<{
|
|||||||
params: get_params(target.match),
|
params: get_params(target.match),
|
||||||
}, results[i].preloaded);
|
}, results[i].preloaded);
|
||||||
|
|
||||||
level.props.child = {
|
level.props.child = {};
|
||||||
segment: new_segments[i + 1]
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
level = level.props.child;
|
level = level.props.child;
|
||||||
|
level.segment = segments[i + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return { data, nullable_depth };
|
return { data, nullable_depth };
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<span>y: {segment} {count}</span>
|
<span>y: {segment} {count}</span>
|
||||||
<svelte:component this={child.component} {...child.props}/>
|
<svelte:component this={child.component} {...child.props}/>
|
||||||
|
|
||||||
|
<span>child segment: {child.segment}</span>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import counts from '../_counts.js';
|
import counts from '../_counts.js';
|
||||||
|
|
||||||
|
|||||||
@@ -630,7 +630,8 @@ function run({ mode, basepath = '' }) {
|
|||||||
.then(text => {
|
.then(text => {
|
||||||
assert.deepEqual(text.split('\n').filter(Boolean), [
|
assert.deepEqual(text.split('\n').filter(Boolean), [
|
||||||
'y: bar 1',
|
'y: bar 1',
|
||||||
'z: baz 1'
|
'z: baz 1',
|
||||||
|
'child segment: baz'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return nightmare.click(`a`)
|
return nightmare.click(`a`)
|
||||||
@@ -642,7 +643,8 @@ function run({ mode, basepath = '' }) {
|
|||||||
.then(text => {
|
.then(text => {
|
||||||
assert.deepEqual(text.split('\n').filter(Boolean), [
|
assert.deepEqual(text.split('\n').filter(Boolean), [
|
||||||
'y: bar 1',
|
'y: bar 1',
|
||||||
'z: qux 2'
|
'z: qux 2',
|
||||||
|
'child segment: qux'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user