Fix $watch scope, Support nested properties, Support watch deep#294
Fix $watch scope, Support nested properties, Support watch deep#294ahmedkandel wants to merge 4 commits intoalpinejs:masterfrom
Conversation
|
Here is a codepen to cover watch cases: |
|
It may need some refactoring, While it will not be easy to get rid of recursive iterations. |
Move watcher constructor inside component constructor
|
What do you think guys? Is this updated implementation better? |
|
I'm going to close this for now and only support shallow "watching" in Alpine V2. I believe this feature will just work out of the box with the new v3 reactivity engine. I know this wasn't an easy implementation, so thank you for the contribution 🙏 |
|
v3 still does not support watch deep, does it? (I just came back to Alpine after last trying V2 and made a small example project. At least I couldn't get it to work and it's not mentioned in the docs either.) |
|
@MrSnoozles haven't tried it myself but you might be able to achieve deep-watching with |
|
How many months or years has this been? I still can't watch an object? How am I supposed to react to changes to the object? DO I need to attach a listener to literally every single item in the UI that is bound to any part of the object? Doesn't seem productive for a JS framework. Makes many, many UIs impractical if not impossible to write. |
|
@justingolden21 You can use |
Replaces #292