-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Bindings with specified signal
binding behavior (BindingSignaler) are being dirty-checked / not waiting for signals to update the view from view-model getters.
#293
Comments
It appears to have the same behavior whether the binding is string interpolation or property binding ( |
The dirty checking is result of |
Using a value converter attains the expected behavior, but why does using a property getter with a signal binding behavior not work in the same way? I created the repro case on gistrun as a simple example, but I don't necessarily want to use a value converter for every time I want to throttle a computed property value. |
After some digging (and some memory surfaced) I found this: The important piece:
which leads me to wonder, is there some way I can tell Aurelia not to dirty check a computed property? It would be great (IMO) if it could detect that all of its bindings have a binding behavior which specify that it shouldn't be observed, so the dirty checking is not necessary. I don't know how feasible that would be. |
If you don't want something to be observed use |
I want the view to update when the property is updated / signaled to be updated, so I have come to understand that this is not the way that it works, but IMO it should. |
well docs state it like:
in other words, it augments binding with a possibility to force reevaluation |
maybe can be closed |
|
@mattgaspar In a binding like this |
I don't think we want the signal binding behavior automatically assumes that it's in charge of the binding update by default. It should be treated as an additional way to notify a binding to update. With that basic in mind, we can refactor the behavior a little bit, so that if the first parameter is an array, then it's assume it's this overload: interface SignalBindingBehavior {
bind(binding: Binding, source: Scope, names: string[], controlBinding?: boolean);
} Note the This is quite an involved refactoring, as it probably requires some changes in binding module as well, I think we may not want to add support for it in v1. In v2, this may be easier to support, though we probably want to wait a bit. |
I'm submitting a bug report
1.4.0
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
8.2.0
NPM Version:
5.3.0
JSPM OR Webpack AND Version
webpack 2.2.1
Browsers:
| Chrome 59 | Firefox 54
Language:
all
Current behavior:
When binding in the view to a getter property in the view-model and specifying the
signal:'my-signal'
binding-behavior, the view is streaming the updates instantly.See the gistrun example here
Expected/desired behavior:
What is the expected behavior?
The getter property should not be accessed until the BindingSignaler signals an update with the specified string.
What is the motivation / use case for changing the behavior?
Unless I misunderstand, the binding signaler is not behaving as it was intended. Some getters (particularly current-time-based computed properties) should only be accessed every so often, so binding signalers seemed to be the best way to do this, except they are not behaving as I would expect.
The text was updated successfully, but these errors were encountered: