Skip to content

Commit 7995996

Browse files
committed
mutation validation is only tangentially linked to context requirement
1 parent 9d499e7 commit 7995996

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ export function client_component(analysis, options) {
393393
);
394394
}
395395

396+
if (analysis.needs_mutation_validation) {
397+
component_block.body.unshift(
398+
b.var('$$ownership_validator', b.call('$.create_ownership_validator', b.id('$$props')))
399+
);
400+
}
401+
396402
const should_inject_context =
397403
dev ||
398404
analysis.needs_context ||
@@ -402,12 +408,6 @@ export function client_component(analysis, options) {
402408
// we want the cleanup function for the stores to run as the very last thing
403409
// so that it can effectively clean up the store subscription even after the user effects runs
404410
if (should_inject_context) {
405-
if (analysis.needs_mutation_validation) {
406-
component_block.body.unshift(
407-
b.var('$$ownership_validator', b.call('$.create_ownership_validator', b.id('$$props')))
408-
);
409-
}
410-
411411
component_block.body.unshift(b.stmt(b.call('$.push', ...push_args)));
412412

413413
let to_push;

0 commit comments

Comments
 (0)