I'm using altjs v0.17.1
I've noticed recently that if I change a state value in the store (see example below), an emit change is triggered automatically after processing the handler. I always thought, (and used it this way for the last year) that I needed to explicitly call this.emitChange(). This resulted in rendering my view twice, as it emitted emitChange twice.
I could not find documentation about this behavior. Therefore I'm wondering if it's the normal behavior or is it a bug ? If it's the normal behavior, I think it should be specified in the documentation.
Thank you.
class MyStore{
constructor() {
this.foo = 'bar';
}
onFooBarChange(val) {
this.foo = val;
//EmitChange is automatically triggered
}
}
This is the normal behavior. You can return false from a store method to prevent emitting a change. this.emitChange is provided for use cases outside of the norm.
Hello,
I'm using altjs v0.17.1 I've noticed recently that if I change a state value in the store (see example below), an emit change is triggered automatically after processing the handler. I always thought, (and used it this way for the last year) that I needed to explicitly call
this.emitChange()
. This resulted in rendering my view twice, as it emitted emitChange twice. I could not find documentation about this behavior. Therefore I'm wondering if it's the normal behavior or is it a bug ? If it's the normal behavior, I think it should be specified in the documentation.Thank you.