-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Rxjs interop updates #49769
Rxjs interop updates #49769
Conversation
Are these changes too late for the RC ? |
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.
reviewed-for: fw-core, public-api
These kinds of changes are exactly the type of thing we should change in the RC period (also RC isn't until tomorrow). Based on feedback during this period, we can and should update features that will go into the final release. |
// fromObservable(Observable<Animal>) -> Signal<Cat> | ||
source: Observable<T>, options: {requireSync: true}): Signal<T>; | ||
export function fromObservable<T, U = undefined>( | ||
source: Observable<T>, options?: {initialValue?: U, requireSync?: boolean}): Signal<T|U> { |
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.
Nit: I'd add an explanatory comment that this signature has to be listed second
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.
It doesn't though, does it? The first two can be in either order. Or do you mean the last one has to be listed third?
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.
reviewed-for: fw-core, public-api
4a777ae
to
fd42d6a
Compare
The initial value used for signals by default is now `undefined`. In addition, there is a new option to express that the signal should emit a value synchronously (`requireSync: true`). When this value is specified, the function will throw _on creation_ if the subscribing to the `Observable` does not result in a synchronous emit.
Based on feedback in the RFC, most would prefer `toSignal` and `toObservable`.
From Ben: > When dealing with any reactive function call you don't control > like `observer.next()` (or anything similar), you want to catch the error > in the producer call, in this case `signal()`. You don't want to catch errors > in the `observer.next` call itself.
`toObservable` creates an `effect` that watches for updates to the source signal. We should allow writes to signals in this effect, which would be consumed by downstream observers.
fd42d6a
to
ec9d734
Compare
* | ||
* @developerPreview | ||
*/ | ||
export interface FromSignalOptions { | ||
export interface toObservableOptions { |
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.
Pascal
Caretaker note: adding the "merge" label based on the conversation with @atscott. |
This PR was merged into the repository by commit 1dddb78. |
#49769) The initial value used for signals by default is now `undefined`. In addition, there is a new option to express that the signal should emit a value synchronously (`requireSync: true`). When this value is specified, the function will throw _on creation_ if the subscribing to the `Observable` does not result in a synchronous emit. PR Close #49769
From Ben: > When dealing with any reactive function call you don't control > like `observer.next()` (or anything similar), you want to catch the error > in the producer call, in this case `signal()`. You don't want to catch errors > in the `observer.next` call itself. PR Close #49769
From Ben: > When dealing with any reactive function call you don't control > like `observer.next()` (or anything similar), you want to catch the error > in the producer call, in this case `signal()`. You don't want to catch errors > in the `observer.next` call itself. PR Close #49769
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
See individual commits