Upgrade to Pro — share decks privately, control downloads, hide ads and more …

3 Effective Rules for Success with Signals in ...

3 Effective Rules for Success with Signals in Angular

Manfred Steyer

July 17, 2024
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. Agenda • Austrian Desserts • Computed • Rendering Effects •

    Business Effects • RxJS Interop • Stores
  2. About me… Manfred Steyer, ANGULARarchitects.io (Remote) Angular Workshops and Consulting

    Google Developer Expert for Angular Blog, Books, Articles, and Talks about Angular Manfred Steyer
  3. Why Signals as Events are Critical? Glitch-free property: Events might

    get lost Quickly leads to Effects with Signal Writes Chains of change and cycles?
  4. However … Angular APIs are more and more Signal-based Using

    Events behind Signal change might feel unnatural <input [(ngModel)]="mySignal" (change)="…">
  5. Overlapping Req. & Race Conditions Pancakes Sacher Cake Ice Cream

    Pancakes switchMap, mergeMap, concatMap, exhaustMap
  6. Overlapping Req. & Race Conditions Pancakes Sacher Cake Ice Cream

    Pancakes switchMap, mergeMap, concatMap, exhaustMap
  7. Stores Streamline Reactive Flow Component Store "Intention" Signal sync/ async

    computed() computed() Currently: Main Use Case for Signas Business Effects, Events, RxJS and/or RxJS
  8. Conclusion Architecture Rule #1 Synchronously derive state where possible Architecture

    Rule #2 Avoid (rendering) effects propagating state and signal writes Architecture Rule #3 Stores make your reactive flow more manageable Component Store
  9. Conclusion Hint #1 Signals play well together with RxJS Hint

    #2 Avoid Race Conditions (e.g. RxJS and/or loading flag) Hint #3 Be aware of options and consequences of Business Effects