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

Expose new_in_scope for signals #1384

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

ealmloff
Copy link
Member

Exposes the new_in_scope function for signals which makes it possible for users to make a signal last longer than the current scope.

For example:

let signals = use_signal(cx, || vec![Signal::new(0)]);
// ...In a Child component...

// Because we use the origin scope of the array, even if the child scope is dropped, the signal will still exist as long as the array does
signals.push(Signal::new_in_scope(123, signals.origin_scope()));

@ealmloff ealmloff added enhancement New feature or request signals Related to the signals crate labels Aug 21, 2023
@JaniM
Copy link
Contributor

JaniM commented Aug 26, 2023

This is particularly important for me. Could we get this merged so I could stop using the branch and enjoy whatever master has? 😄

@jkelleyrtp jkelleyrtp merged commit 1ba6ca3 into DioxusLabs:master Aug 31, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request signals Related to the signals crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants