Skip to content

Demo code linked at $effect.tracking documentation is outdated #13902

@rintheo

Description

@rintheo

Describe the bug

The demo code at $effect.tracking documentation is outdated as it still uses $effect.active which causes the playground compiler to throw an error:

Error compiling App.svelte

line 2 column 36

The current demo code:

<script>
	console.log('in component setup:', $effect.active()); // false

	$effect(() => {
		console.log('in effect:', $effect.active()); // true
	});
</script>

<p>in template: {$effect.active()}</p> <!-- true -->

When updated as below will now compile:

<script>
	console.log('in component setup:', $effect.tracking()); // false

	$effect(() => {
		console.log('in effect:', $effect.tracking()); // true
	});
</script>

<p>in template: {$effect.tracking()}</p> <!-- true -->

Reproduction

Linked demo from the docs

Or the demo link from the first paragraph of $effect.tracking documentation.

Logs

No response

System Info

Not relevant

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions