Closed boradparas closed 8 months ago
@boradparas
The issue may be related to this PR. Since 2.2.3, mobx
checks for equality of map, iterable with DeepCollectionEquality
.
Could you try one of the following?
@alwaysNotify
instead of @observable
.
@alwaysNotify
ObservableMap<String, ParticipantExtended> sortedParticipants = ObservableMap<String, ParticipantExtended>();
==
and hashCode
in ParticipantExtended
. Avoid unnecessary observable notifications of Iterable
or Map
fields.Same for ObservableList etc.
How can I notify observer now, when changing attrs on objects within list or map? Equality checks only addresses in memory, but not theirs contents...
Is this tool only suitable for simple lists of strings and numbers? Previously, it was possible to work with objects.
@alexggordon
How can I notify observer now, when changing attrs on objects within list or map? Equality checks only addresses in memory, but not theirs contents...
Can you please provide reproducible code? Then I can tell you how to do it. Alternatively, see the documentation.
Could you try one of the following?
@alwaysNotify
.==
and hashCode
in Object@amondnet
Could you try one of the following?
- use
@alwaysNotify
.
I tried it. Without changes. Perhaps I didn’t fully understand how to apply it correctly.
- override
==
andhashCode
in Object- use immutable data class
Looks like a suitable solution. I'll try this approach. Thank you very much!
https://github.com/mobxjs/mobx.dart/pull/971
Make the change in 2.2.3 optional. If you want the use this behavior , modify
@observable
to@MakeObservable(useDeepEquality: true)
.
I am using so many ObservableMaps in the app and none of them are updating the UI since I upgraded to 2.2.3
@observable ObservableMap<String, ParticipantExtended> sortedParticipants = ObservableMap<String, ParticipantExtended>();
What change I need to make to keep it working as earlier it used to work?