mirror of https://github.com/sveltejs/svelte
parent
9ca41a3add
commit
491fe89bf1
@ -1,9 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
let { track, value, ...rest } = $props();
|
let { track, value, ...rest } = $props();
|
||||||
|
let indirect = $derived(rest.other);
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
track;
|
track;
|
||||||
|
|
||||||
return () => console.log(`value = ${value}, other = ${rest.other}`);
|
return () => console.log(`value = ${value}, other = ${indirect}`);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
import 'svelte/internal/disclose-version';
|
||||||
|
import * as $ from 'svelte/internal/client';
|
||||||
|
|
||||||
|
export default function Props_teardown_optimization($$anchor, $$props) {
|
||||||
|
$.push($$props, true);
|
||||||
|
|
||||||
|
let doubled = $.derived(() => $$props.derived_prop * 2);
|
||||||
|
let indirect = $.derived(() => $.get_prop_value($$props, 'indirect_prop'));
|
||||||
|
let read_function_prop = () => $$props.function_prop;
|
||||||
|
let read_function_cleanup_prop = () => $.get_prop_value($$props, 'function_cleanup_prop');
|
||||||
|
|
||||||
|
$.user_effect(() => console.log($$props.effect_prop));
|
||||||
|
$.user_effect(() => console.log(read_function_prop()));
|
||||||
|
$.user_effect(() => () => console.log($.get_prop_value($$props, 'cleanup_prop')));
|
||||||
|
$.user_effect(() => () => console.log($.get(indirect)));
|
||||||
|
$.user_effect(() => () => console.log(read_function_cleanup_prop()));
|
||||||
|
someFunction(() => $.get_prop_value($$props, 'unknown_prop'));
|
||||||
|
$.next();
|
||||||
|
|
||||||
|
var text = $.text();
|
||||||
|
|
||||||
|
$.template_effect(() => $.set_text(text, $.get(doubled)));
|
||||||
|
$.append($$anchor, text);
|
||||||
|
$.pop();
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import * as $ from 'svelte/internal/server';
|
||||||
|
|
||||||
|
export default function Props_teardown_optimization($$renderer, $$props) {
|
||||||
|
$$renderer.component(($$renderer) => {
|
||||||
|
let {
|
||||||
|
derived_prop,
|
||||||
|
indirect_prop,
|
||||||
|
function_prop,
|
||||||
|
function_cleanup_prop,
|
||||||
|
effect_prop,
|
||||||
|
unknown_prop,
|
||||||
|
cleanup_prop
|
||||||
|
} = $$props;
|
||||||
|
|
||||||
|
let doubled = $.derived(() => derived_prop * 2);
|
||||||
|
let indirect = $.derived(() => indirect_prop);
|
||||||
|
let read_function_prop = () => function_prop;
|
||||||
|
let read_function_cleanup_prop = () => function_cleanup_prop;
|
||||||
|
|
||||||
|
someFunction(() => unknown_prop);
|
||||||
|
$$renderer.push(`<!---->${$.escape(doubled())}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<script>
|
||||||
|
let {
|
||||||
|
derived_prop,
|
||||||
|
indirect_prop,
|
||||||
|
function_prop,
|
||||||
|
function_cleanup_prop,
|
||||||
|
effect_prop,
|
||||||
|
unknown_prop,
|
||||||
|
cleanup_prop
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
let doubled = $derived(derived_prop * 2);
|
||||||
|
let indirect = $derived(indirect_prop);
|
||||||
|
let read_function_prop = () => function_prop;
|
||||||
|
let read_function_cleanup_prop = () => function_cleanup_prop;
|
||||||
|
|
||||||
|
$effect(() => console.log(effect_prop));
|
||||||
|
$effect(() => console.log(read_function_prop()));
|
||||||
|
$effect(() => () => console.log(cleanup_prop));
|
||||||
|
$effect(() => () => console.log(indirect));
|
||||||
|
$effect(() => () => console.log(read_function_cleanup_prop()));
|
||||||
|
|
||||||
|
someFunction(() => unknown_prop);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{doubled}
|
||||||
Loading…
Reference in new issue