-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
Feat: Allow a custom equals parameter for ObservableStream #771
Conversation
❌ Deploy Preview for mobx failed.
|
Codecov Report
@@ Coverage Diff @@
## master #771 +/- ##
=======================================
Coverage 98.90% 98.90%
=======================================
Files 55 55
Lines 1920 1923 +3
=======================================
+ Hits 1899 1902 +3
Misses 21 21
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
c2bc0e8
to
35aea22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add to the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a changelog and version bump for the mobx package
35aea22
to
8029688
Compare
f9644fd
to
4b5119a
Compare
Can you resolve conflicts pls before the merge. Also will need to bump up the version for publishing and add to changelog |
Signed-off-by: Minsu Lee <amond@amond.net>
97521ab
to
e7b88a9
Compare
Signed-off-by: Minsu Lee <amond@amond.net>
@pavanpodila Done. |
@@ -332,7 +345,8 @@ class _ObservableStreamController<T> { | |||
name: '$name.status'), | |||
_valueType = Observable(_ValueType.value, | |||
context: context, name: '$name.valueType'), | |||
_data = Observable(initialValue, context: context, name: '$name.data') { | |||
_data = Observable<dynamic>(initialValue, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not Observable<T?>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_data.value = error; |
Yes, I would like to use Observable<T?>
, but Object
type is assigned inside the _onError
function.
void _onError(Object error) {
final actionInfo = _actions.startAction();
try {
_status.value = StreamStatus.active;
_valueType.value = _ValueType.error;
_data.value = error;
} finally {
_actions.endAction(actionInfo);
_tryInsertInitialValue();
_controller.addError(error);
}
}
* feat: allow a custom equals parameter for ObservableStream Signed-off-by: Minsu Lee <amond@amond.net> * feat: allow a custom equals parameter for ObservableStream Signed-off-by: Minsu Lee <amond@amond.net> Signed-off-by: Minsu Lee <amond@amond.net> Co-authored-by: Pavan Podila <pavanpodila@users.noreply.github.com>
* feat: allow a custom equals parameter for ObservableStream Signed-off-by: Minsu Lee <amond@amond.net> * feat: allow a custom equals parameter for ObservableStream Signed-off-by: Minsu Lee <amond@amond.net> Signed-off-by: Minsu Lee <amond@amond.net> Co-authored-by: Pavan Podila <pavanpodila@users.noreply.github.com>
@all-contributors please add @amondnet for doc |
I've put up a pull request to add @amondnet! 🎉 |
Create a custom equals parameter for
ObservableStream
, like what exists already forObservable
.Currently,
ObservableStream
uses == to determine if the value changed. This creates an option to override that with a different EqualityComparator.mobx.dart/mobx/lib/src/api/async/observable_stream.dart
Line 439 in f8677da
mobx.dart/mobx/lib/src/core/observable.dart
Line 62 in f8677da
mobx.dart/mobx/lib/src/core/observable.dart
Line 106 in f8677da
#679