Skip to content

Commit ae15864

Browse files
committed
revert some stuff
1 parent 5ddcdd5 commit ae15864

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export function CallExpression(node, context) {
9696
}
9797

9898
context.state.analysis.props_id = parent.id;
99-
context.state.analysis.needs_context = true;
10099

101100
break;
102101
}

packages/svelte/src/compiler/phases/3-transform/client/transform-client.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,7 @@ export function client_component(analysis, options) {
398398

399399
// we want the cleanup function for the stores to run as the very last thing
400400
// so that it can effectively clean up the store subscription even after the user effects runs
401-
// if we have $props.id `should_inject_context` will always be true
402401
if (should_inject_context) {
403-
// we need to put the `$props.id` after the `$.push` because the `component_context` will be properly initialized
404-
if (analysis.props_id) {
405-
// need to be placed on first line of the component for hydration
406-
component_block.body.unshift(b.const(analysis.props_id, b.call('$.props_id')));
407-
}
408402
component_block.body.unshift(b.stmt(b.call('$.push', ...push_args)));
409403

410404
let to_push;
@@ -568,6 +562,11 @@ export function client_component(analysis, options) {
568562
component_block.body.unshift(b.stmt(b.call('$.check_target', b.id('new.target'))));
569563
}
570564

565+
if (analysis.props_id) {
566+
// need to be placed on first line of the component for hydration
567+
component_block.body.unshift(b.const(analysis.props_id, b.call('$.props_id')));
568+
}
569+
571570
if (state.events.size > 0) {
572571
body.push(
573572
b.stmt(b.call('$.delegate', b.array(Array.from(state.events).map((name) => b.literal(name)))))

packages/svelte/src/internal/client/render.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
212212
if (context) {
213213
push({});
214214
var ctx = /** @type {ComponentContext} */ (component_context);
215-
if (context) {
216-
ctx.c = context;
217-
}
215+
ctx.c = context;
218216
}
219217

220218
if (events) {

0 commit comments

Comments
 (0)