Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation about how dependency tracking works #252

Closed
lukechu10 opened this issue Sep 19, 2021 · 1 comment · Fixed by #253
Closed

Documentation about how dependency tracking works #252

lukechu10 opened this issue Sep 19, 2021 · 1 comment · Fixed by #253
Labels
A-docs Area: documentation good first issue Good for newcomers

Comments

@lukechu10
Copy link
Member

Dependency tracking is topological, meaning that dependencies must be accessed before the tracking scope returns.

create_effect(move || {
    // blah blah...
    
    wasm_bindgen_futures::spawn_local(async move {
        // This scope is not tracked because spawn_local runs on the next microtask tick (in other words, some time later).
    };
    // Everything that is accessed until here is tracked. Once this closure returns, nothing is tracked.
});

This means that accessing signals or other dependencies inside something like wasm_bindgen_futures::spawn_local will not track the dependencies and might not be what the author intended.

This should be clarified in the documentation about "Reactivity"

@lukechu10 lukechu10 added A-docs Area: documentation good first issue Good for newcomers labels Sep 19, 2021
@arctic-hen7
Copy link
Contributor

I'm happy to do this if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants