Replies: 3 comments
-
For sure Proxies come with added challenges, but they also solve some unique issues that no other JS primitive can solve. Proposed solutions:
This is interesting because it avoids proxy issues and it's much faster. But it has a critical limitation: you can't observe property addition (and rarely: deletion). A critical special case of this is arrays. Reactive library have traditionally required usage of a getter/setter function to work around this limitation, i.e. I think property-based reactivity is interesting and has use-cases but it's not a substitute for proxies. It could complement proxies, as an alternative where applicable.
This is a goal, not a solution. As proxies are "standard JavaScript", the argument is a little flawed but I get what you mean.
As of today, Signals are a limited low-level reactivity primitive that basically exposes the equivalent of Vue Saying that TC39 Signals is more debugging-friendly is similar to not using |
Beta Was this translation helpful? Give feedback.
-
@jods4 thank you for taking the time to answer. As you can see I do not come with a complete solution, I have however found the proxies a bit hard to work with during the past few years using Vue 3. True that you can expand them, but working on several larger projects using Vue 3 I find myself slowed down quite a lot when doing console.log style debugging on nested objects. You do point out a few great points that distinguish Lit from Vue in that Vue Composables often are dynamic objects where it is hard to tell which properties that needs monitoring. Lit reactive properties are of course closer to Vue props. Using a combination of standard custom elements created with Lit and Vue in apps for a long time now I always find the custom elements so much easier to debug. It would be great with the same simplicity for the Vue system as well, but I see the challenge. JavaScript not having any great hash mechanic to check for equality between objects also makes it a challenge, which makes periodic checking a bit more expensive. Maybe as you said a class system with "reactive" properties could help a bit as an alternative to composables. Array methods could be overwritten, but direct index assignment with arrays is still a gap. |
Beta Was this translation helpful? Give feedback.
-
That's very similar to how Vue 2 worked (see its "Reactivity in Depth" docs).
Fixing those issues, and adding reactivity for other native data types (like |
Beta Was this translation helpful? Give feedback.
-
Vue 3's proxy-based reactivity system has introduced significant performance improvements but has also created substantial challenges in debugging and inspecting reactive state. This issue aims to address these challenges and explore potential solutions to improve the developer experience, especially when working without Vue DevTools.
Current Challenges:
.toRaw()
/JSON.parse(JSON.stringify(object))
, Vue DevTools or custom debugging utilities, which may not always be available or preferred.Proposed Solutions:
Benefits:
Beta Was this translation helpful? Give feedback.
All reactions