Is complex RxJS still useful with Angular signals?

preview_player
Показать описание

In this video, I revisit one of my more complex RxJS streams in an Angular application and refactor it to use the new state management approach I've been using with Angular signals.

0:00 Introduction
1:38 Recap
2:30 Fetching data
3:22 Handling errors
4:37 Recursive fetching
5:30 Pagination
6:52 Thoughts

#angular #rxjs #signals

Рекомендации по теме
Комментарии
Автор

The sample code, graphics, annotation, and editing. This channel is the finest coding channel produced by the author who really care.

sakesun
Автор

NGRX has the sweet spot for us - it allows to expose selectors as signals. Wonderful

LarsRyeJeppesen
Автор

Thanks for the expand operator explanation 🔥🔥🔥 I have never used it before 👍 About the rest of code: anytime I’m about to use rxjs ill think twice, because it not only add a huge cognitive load to the code reader but also gives an opportunity to add a lot of memory leaks in code. Like react devs always think about “performance and extra renders “ issue, angular devs also think about where they can add another memory leak. Sometimes rxjs becomes a “leaky abstraction” that also provides more complexity than it resolves, sometimes rxjs is pretty necessary. Anyway thanks for the video 🔥🔥🔥

glazevolda
Автор

Your channel inspires me, I'm really curious to know how you make these slides, it looks like it was done by hand, thanks for the video

philip-rodrigues
Автор

I’ve just had a little brain lightbulb: signal() is to computed() as Subject is to Observable. If your application is declarative, computed signals and observables only react. Whereas (writable) signals and subjects can be changed more directly. To be more declarative, lean towards computed signals and observables whenever possible.

holycrimpsauce
Автор

I still watch your videos even though I´m no longer writing Angular code all that often, since starting a new job been using react for the first time. I´m interested to keep following along, recently build an infinite scroll feature similar to this so far so good, React feels more like writing vanilla JS but im keen to stay in touch with the Angular ecosystem things are moving fast for as much pain RXJS can be to learn it´s very powerful.

machiinate
Автор

This is very nice. I was interested in seeing how you would integrate the pagination subject (when to reset, etc) but i forgot reddit api works differently

pedrofernandes
Автор

I wish I fully understood the rxjs the way you do. My app uses rxjs crudely, but has a smattering of imperative stuff built in still as I don't fully know how to do all the rxjs awesomeness you show.

supirman
Автор

Great video as usual. I do wish though that you could explain why this solution (or part of it) using only signals would not work. The same way you explained how signals solved the diamond problem of rxjs in your other video "why angular team didn't go with rxjs?"

bric
Автор

Signals for State, Rxjs for events ✅️

TayambaMwanza
Автор

Beautiful code, well done. Two questions:
- Did you consider to use the materialize operator to materialize errors instead of adding and extra Observable for the error?
- Did you consider using a BehaviorSubject to get rid of the startsWith operator for the pagination?

kaischonberger
Автор

I'm not sure I understand the choices made with error handling, maybe I'm missing some context.

You have an error property in the state signal that doesn't appear to be used, instead, you are handling errors with a stream (rxjs Subject). Why is this? Why have an error property in the state if you are not going to use it, and why is a stream of errors more helpful than updating the state with any errors that are caught?

neilfarted
Автор

are you going to make a video about your transition to neovim and how you configured it

tolstoievski
Автор

Can you not skip the imperative bridge by using the toSignal method from rxjs-interop and wrap the observable?

kingpinkent
Автор

Is there a specific reason to use Subject sources and not BehaviourSubject sources? Because almost always you're using startWith operator to give it an initial value anyways...?

shivisuper
Автор

What're the pros and cons in regards to those subscriptions acting as reducers compared with using a tap operator in the original observable declarations?

jakehockey
Автор

Why are you using signal.update() instead of signal.mutate()? Is there specific reason for that?

Автор

I have a question, when you setup a subscription in the constructor, and in the subscribe, update the signal, is the subscription cancelled or unsubscribed automatically then? Or have you just omitted that to minimize the code in the example? Thanks for all the great content

vredurs
Автор

The problem with all this is that in reality it would be first loaded on the server with SSR for seo (which would be promises), then hydrated and subscribed to changes...

jonathangamble
Автор

This approach isn't it require a lot memory keeping the gifts in an observable and in a signal again? Isn't it the same data twice in memory?

icoz
welcome to shbcf.ru