You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks like a lot, and generally library authors are used to jumping through hoops to making things nice for their users, but we should strive to make things as easy as possible for library authors as well.
but the gist is that, in order to have lazily evaluated reactive properties, we need to pass functions.
the Cell concepts gets around this by lazily evaluating upon access of .current (or .read()), but @tracked properties don't have these capabilities.
For this example, the call-site may look like this:
classX{
@trackedtext='...';
@trackedformat='gjs';
@usecompiled=Compiled(()=>this.text,()=>this.format);// or
@usecompiled=Compiled(()=>this.text,()=>({format: this.format});// orcompiled=use(this,Compiled( ... ))}
The way @tracked properties are fine-grainedly consumed in a resource API is entirely up to the resource-author -- they can choose how fine-grained they want their arguments to be.
So, to help, we should provide a utility, which would turn the above snippet in to this:
This should probably live in starbeam or something (eventually), but the problem is shown here, in the docs: https://github.com/NullVoxPopuli/ember-resources/blob/main/docs/docs/ember.md#for-library-authors
This looks like a lot, and generally library authors are used to jumping through hoops to making things nice for their users, but we should strive to make things as easy as possible for library authors as well.
Specifically, this code
but the gist is that, in order to have lazily evaluated reactive properties, we need to pass functions.
the
Cell
concepts gets around this by lazily evaluating upon access of.current
(or.read()
), but@tracked
properties don't have these capabilities.For this example, the call-site may look like this:
The way
@tracked
properties are fine-grainedly consumed in a resource API is entirely up to the resource-author -- they can choose how fine-grained they want their arguments to be.So, to help, we should provide a utility, which would turn the above snippet in to this:
Thanks @simonihmig for pushing me on this 🎉
The text was updated successfully, but these errors were encountered: