-
Notifications
You must be signed in to change notification settings - Fork 12
Description
The section on visibility scopes for subjects could be improved, as I think this might be a stumbling block, but it's important for people to understand.
- One potentially confusing point for me that I encountered was that the screenshot for this section shows
GroupWorkflownodes, which I believe always share the same scope, and that it is not possible to make one with a new scope. I noted this down in Update workflow images to workflow containers #96. Others have also encountered the same issue https://github.com/orgs/bonsai-rx/discussions/1664.
Several possible solutions
- I believe we should change the node for
NewScopeto a higher-order observable that does create a new scope, likeCreateObservable.CreateObservableis a good candidate for this, as it has been covered in the previous article on higher-order observables, and I think it is a bit more intuitive for people to understand a possible situation where a new scope is being declared. - Another alternative is to have in the screenshot examples of several nested operators that share the same scope as the outer workflow (I believe only
IncludeWorkflowandGroupWorkflowoperators) and other operators likeCreateObservable,Defer, andSelectMany.
Another point is that the example screenshot does not illustrate how scopes work, and the text is a little hard to understand for a beginner.
- We could build out a more complete working example. For instance, by using the same example from the beginning of the article (a
PublishSubjectfrom aCameraCapture) and comparing how it works in aGroupWorkflowand aDefer.
Another common question that people ask is also how to share a subject that is in an inner scope with the outer scope, and it might be nice to add that one can declare the subject in the outer scope first (with a source subject) and cast to it in the inner scope. See https://github.com/orgs/bonsai-rx/discussions/1676. However, this might be out of "scope" for this revision (haha).
Some additional comments here that I have yet to digest, but which might be nice to add.