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

impl Dispose for Callback types and add try_run to the Callable trait #3371

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

basro
Copy link

@basro basro commented Dec 16, 2024

PR aims to make the Callback types more consistent with the other stored types in leptos.

  • Adds try_run to callable which (in line with other stored types) will return None if the callback had been disposed.
  • Adds impl Dispose for both Callback and UnsyncCallback

Small detail regarding implementation:
The impl of Callable::run for UnsyncCallback and Callback was inconsistent. One used try_with_value with expect while the other was using with_value.
I chose to make them consistent and use with_value in both impls. I'm unsure if I chose the right option, perhaps try_with_value was preferable.

@gbj gbj added the breaking label Dec 17, 2024
@gbj
Copy link
Collaborator

gbj commented Dec 17, 2024

I'm very open to adding this.

Note that as it stands, it is a breaking change (adds a required method to a pub trait) so can't be merged until 0.8. I'm currently planning on releasing a 0.8 some time in January that includes any very minor-but-breaking changes like this that have turned up as people test out 0.7 further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants