-
Notifications
You must be signed in to change notification settings - Fork 18
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
Modifier called on each class property update #223
Comments
From what I understood about our expression engine, as soon as you use a reference to a property or a method on an object, the expression watch the object for any change. This is what is happening here. Thus I agree, it sounds like an aggressive refresh politic, but I would tend say that it is working as designed... |
I had a hunch this would be the reason considering the same code with the filter defined outside the class but given the controller as an argument behaves the same way. Is there a particular reason why in |
My answer is not going to be simple and clear... 😞 |
@olaf-k filters can have dynamic arguments that might change the filtering result, hence the watch. At least this is my mental model of those things... |
@PK1A makes sense to watch arguments indeed. However in |
@olaf-k OK, sorry for not being precise. Arguments are one part of the story and I think we all agree for the need of watching explicit arguments. But recently @b-laporte introduced possibility of specifying objects with the Disclaimer: I don't know all the internals / details so might be as well making up things here... |
@olaf-k the behaviour you see on filter is the same as for functions/methods - as the filter is a function (or references an implicit function such as apply). So in case of a function used in a template expression hashspace will observe the function argument and the function context (i.e. the this object) as methods frequently use other members of their associated object. |
@b-laporte from what I understood on @olaf-k sample, each time you type something in the input the filter gets called.... |
OK, so - I discussed this with @b-laporte and learned that methods can actually be bound and that when they are, both their arguments and their context are watched. From what I understood this was introduced when solving #50 but I wasn't aware of this new behavior -- that basically answers #75 by the way (just not how I expected it to.) I'm a bit partial about this and still believe it would be great for developers to have a way to explicitly state a method's dependencies, overriding the framework's "I'll watch everything" functionality. We could discuss in a meeting, but feel free to comment here as well. Edit:
|
Consider the following:
The filter is called each time
c.someval
is udpated. (This doesn't happen if the filter is defined outside the class.)The text was updated successfully, but these errors were encountered: