-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
Assignation of @observable property not working after 2.1.3+1 ! #933
Comments
Hello, |
https://github.com/mobxjs/mobx.dart/blob/master/mobx/CHANGELOG.md#214 Yes Prior to 2.1.4, this caused an unnecessary reaction even when the value hadn't actually changed. This was unintended behaviour. From 2.1.4, as intended, reactions are only fired if the value has actually changed, which reduces unnecessary builds and improves performance. @readonly
int _value;
void setValue(int value) {
_value = value;
} 2.1.3 setValue(1); // reaction
setValue(1); // reaction 2.1.4 setValue(1); // reaction
setValue(1); // No reaction occurs #907 If you don't care about unnecessary builds and performance, use @alwaysNotify
Ticket? ticket;
@action
updateTicket(Message message) {
// Here this.ticket != null because it's set before
// Here this.ticket.id == message.data.id
// Here this.ticket.updatedAt != message.data.updatedAt
this.ticket = message.data;
// Here this.ticket.updatedAt is always != message.data.updatedAt
// What is this witchcraft ?
} However, the recommended approach is
|
Thank you for your time, I understand better now ! :) |
Hello,
The assignation of @observable property not working if property != null;
Important note Ticket have a custom equals and hash code based uniquely on ticket.id property.
Is this the desired behaviour ?
The text was updated successfully, but these errors were encountered: