Skip to content
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

TakeUntil Different Working from Docs #2473

Closed
4 of 17 tasks
yudonlee opened this issue Dec 29, 2022 · 5 comments
Closed
4 of 17 tasks

TakeUntil Different Working from Docs #2473

yudonlee opened this issue Dec 29, 2022 · 5 comments

Comments

@yudonlee
Copy link

yudonlee commented Dec 29, 2022

⚠️ If you don't have something to report in the following format, it will probably be easier and faster to ask in the slack channel first. ⚠️

⚠️ Please take you time to fill in the fields below. If we aren't provided with this basic information about your issue we probably won't be able to help you and there won't be much we can do except to close the issue :( ⚠️

If you still want to report issue, please delete above statements before submitting an issue.

Short description of the issue:
TakeUntil Docs Says

If this second Observable emits an item or sends a termination notification, the Observable returned by TakeUntil stops mirroring the source Observable and terminates

But if Second Observable terminates, Source observer still can emit the item.
description here

Expected outcome:

onNext("A")
onNext("B")

What actually happens:

onNext("A")
onNext("B")
onNext("C")

Self contained code example that reproduces the issue:

let subject = PublishSubject<String>()
let trigger = PublishSubject<String>()
        
        subject
            .take(until: trigger)
            .subscribe(onNext: {
                print($0)
            })
            .disposed(by: disposBag)
        
        subject.onNext("A")
        subject.onNext("B")
        trigger.onCompleted()
        subject.onNext("C")

RxSwift/RxCocoa/RxBlocking/RxTest version/commit
6.0.0
version or commit here

Platform/Environment

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Xcode version:

  Xcode version goes here

⚠️ Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. ⚠️

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • yes (which ones)
  • no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base
@danielt1263
Copy link
Collaborator

I believe this is a mistake in the documentation. The observable passed into take(until:) will only terminate the source on an onNext or onError event, not for onCompleted.

This is also how the reference implementation for C# works.

@yudonlee
Copy link
Author

yudonlee commented Jan 2, 2023

I believe this is a mistake in the documentation. The observable passed into take(until:) will only terminate the source on an onNext or onError event, not for onCompleted.

This is also how the reference implementation for C# works.

Thank you! I didn't think the document was wrong. But why doesn't the document change?

@danielt1263
Copy link
Collaborator

Exactly what file are you talking about with incorrect documentation? I invite you to submit a pull request with the file corrected.

@yudonlee
Copy link
Author

The document I'm talking about is the official Reactive.io document.!
https://reactivex.io/documentation/operators/takeuntil.html

@danielt1263
Copy link
Collaborator

I submitted a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants