Replies: 2 comments 7 replies
-
this will not work, because Reading signals directly, not in a reactivity context might or might not be a good idea. From the first look, we have no benefits out of it, but we might have them if we need not only to read the signal but also filter produced values. For example: pipe(
withLatestFrom(toObservable(userStore.user).pipe(
filter(user => !!user)
)),
switchMap(([data, user]) => {
// Do something else
}),
); The code above will only get to On the other side, if we do not need such logic (filters, combinations, and so on), we can read the signal directly. |
Beta Was this translation helpful? Give feedback.
-
This seems like an unnecessary complication to me. As you mentioned: pipe(
switchMap((data) => {
const user = userStore.user();
})
) is 👌 |
Beta Was this translation helpful? Give feedback.
-
Similar question to #4121…
Let's say I have the following effect in a ComponentStore:
But what if
userStore.user
is a signal, not an observable (like it would be usingsignalStore
)? What would the equivalent (and best practice) be in a signal store'srxMethod
?An initial idea:
Maybe we don't even need to convert the signal to an observable? How about?
Would this make sense? Is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions