-
Notifications
You must be signed in to change notification settings - Fork 271
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
rxdart 0.27.2 introduces a breaking change to BehaviorSubject.map #625
Comments
Before:
var s = BehaviorSubject.seedee(1);
print(s.value); // 1
ValueStream<int> mapped = s.map((v) => v + 1);
print(mapped.value); // throws Error Safety way is using Now:
var s = BehaviorSubject.seedee(1);
print(s.value); // 1
ValueStream<int> mapped = s.map((v) => v + 1).shareValueSeeded(s.value + 1);
print(mapped.value); // 2 |
That said, it is a breaking change with no prior indication that this was an internal method, so it breaks apps/plugins that were previously depending on it. I think the correct way to remove this method would be to first deprecate it and remove it in the next major version. But I think a better solution is to improve the semantics of this method rather than remove it in the next release. i.e.
|
That is method overriding, cannot deprecated them. |
Ah, I didn't think of that. Although the solution I really prefer doesn't require deprecation anyway ;-) i.e. Keep the override so as to avoid any breaking change on a minor release, and then pave the pathway to support a specialised |
Yeah, that change broke my app as well. I wasn't aware of all methods available in rxdart, and I read "changelog" after upgrade, but I couldn't figure out how to fix it, before I found this thread. I believe that for this change, we should add a note in a "changelog", and suggest a workaround with correct syntax as mentioned in there #625 (comment) Also, what would be a workaround for btw thanks for the library overall :) |
final s = BehaviorSubject.seeded(1);
Future<String> converter(int v) { }
ValueStream<String?> mapped = s.asyncMap(converter)
.cast<String?>()
.shareValueSeeded(null); // null means loading state
String? value = mapped.valueOrNull;
if (value == null) {} // loading
else {}
mapped.listen((String? value) {
if (value == null) {} // loading
else {}
});
Sent from my Redmi 7A using FastHub |
This change broke my app as well. I think it's ok to release breaking changes, as long as semantic versioning is followed. |
In rxdart 0.27.1,
BehaviorSubject.map
returns aValueStream
but this breaks in 0.27.2 which returns aStream
(a minor version increment). I like being able to map aValueStream
into anotherValueStream
, so maybe this interface should be defined as part of theValueStream
API, but in any case I think the behaviour should at least be brought back toBehaviorSubject
to avoid the breaking change.The text was updated successfully, but these errors were encountered: