fix: move ownership validation into async component body

pull/16449/head
ComputerGuy 2 months ago
parent 27c90dfa83
commit bf9d999a9b

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: move ownership validation into async component body

@ -364,6 +364,12 @@ export function client_component(analysis, options) {
: b.stmt(b.call('$.init', analysis.immutable ? b.true : undefined))
]);
if (analysis.needs_mutation_validation) {
component_block.body.unshift(
b.var('$$ownership_validator', b.call('$.create_ownership_validator', b.id('$$props')))
);
}
const should_inject_context =
dev ||
analysis.needs_context ||
@ -434,12 +440,6 @@ export function client_component(analysis, options) {
);
}
if (analysis.needs_mutation_validation) {
component_block.body.unshift(
b.var('$$ownership_validator', b.call('$.create_ownership_validator', b.id('$$props')))
);
}
// we want the cleanup function for the stores to run as the very last thing
// so that it can effectively clean up the store subscription even after the user effects runs
if (should_inject_context) {

Loading…
Cancel
Save