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

.watch(context) vs Watch differences #257

Open
PaulHalliday opened this issue Apr 23, 2024 · 2 comments
Open

.watch(context) vs Watch differences #257

PaulHalliday opened this issue Apr 23, 2024 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@PaulHalliday
Copy link
Contributor

I've been using signals/lite_ref in my project, and part of my implementation relies on overriding a scoped dependency to provide demo data for a "preview" mode of a particular set of widgets.

I ran into an issue where I had to replace my Watch for .watch(context) as it did not work correctly otherwise:

jinyus/lite_ref#24

As I figured that Watch and .watch(context) were interchangeable (and especially considering the docs suggest using Watch over .watch(context)), are there any other/specific scenarios where this is expected?

@rodydavis
Copy link
Owner

The biggest difference is that Watch will rebuild for inherited widgets listened instead the callback (theme/media) and is an effect.

.watch calls the subscribe method for a specific signal.

That being said I am very interested and will see if we can get some tests added to make sure they are aligned as much as possible (inherited widgets will rebuild a lot more outside of my control).

@rodydavis
Copy link
Owner

Could you share a minimal example for reference?

@rodydavis rodydavis added bug Something isn't working enhancement New feature or request labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants