Don't make my toSignal mistake in Angular

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 พ.ย. 2024

ความคิดเห็น • 28

  • @JoshuaMorony
    @JoshuaMorony  7 หลายเดือนก่อน +1

    Join the weekly newsletter: mobirony.ck.page/4a331b9076

  • @dev_bits
    @dev_bits 3 หลายเดือนก่อน +1

    This kind of tips what the developers need. Thanks.

  • @moitp2
    @moitp2 7 หลายเดือนก่อน +20

    I am not sure to understand why this is not set by default tbh

  • @StephenMoreira
    @StephenMoreira 7 หลายเดือนก่อน +3

    Short and sweet, thanks for the tip.

  • @DorianDauphin
    @DorianDauphin 7 หลายเดือนก่อน +1

    Thanks for the content, Joshua.
    In a previous video, you stated that we should use Signal for synchronous tasks and RxJS when dealing with asynchronous tasks, but this still isn't very clear to me. It would be nice if you could make a video with simple examples showing when it is more appropriate to use signals over RxJS, or vice versa.
    Have a good day !

  • @andresmauriciofajardoolaya2721
    @andresmauriciofajardoolaya2721 7 หลายเดือนก่อน

    Thanks for the content Joshua

  • @ianokay
    @ianokay 7 หลายเดือนก่อน +1

    Very useful information from the cutting edge, nice video thanks. Unfortunate that it seems you have to spam every toSignal in your application with that object property if you want centralized error handling.

    • @JoshuaMorony
      @JoshuaMorony  7 หลายเดือนก่อน

      I suppose you could also write a little helper utility if you wanted to have it by default everywhere

  • @SamiullahKhan
    @SamiullahKhan 2 หลายเดือนก่อน

    A case is made for the errors, how do you handle success feedback, like showing success message. Especially if they are invoked by calling a service method?

  • @g-luu
    @g-luu 7 หลายเดือนก่อน

    Great one thanks

  • @trevormontgomery6795
    @trevormontgomery6795 7 หลายเดือนก่อน +1

    I think this might be my problem in something I'm working on. I was getting what seems like a recursion error when I make an http call. An error must be occurring and angular things I've got a recursive function

  • @shreyanshjain9479
    @shreyanshjain9479 7 หลายเดือนก่อน

    That's really cool trick❤

  • @valsimot-pod-dunavom
    @valsimot-pod-dunavom 7 หลายเดือนก่อน

    great video, thanks for the info :D

  • @PavelKostenko
    @PavelKostenko 7 หลายเดือนก่อน

    What code editor are you using, is this nvim inside tmux? Please share your setup

    • @JoshuaMorony
      @JoshuaMorony  7 หลายเดือนก่อน +1

      Yes it is - this video is somewhat old but covers most of what I am using: th-cam.com/video/P5QPacz2-ao/w-d-xo.html I do have a couple other videos I think that talk about various aspects of my workflow/neovim setup

  • @anon5992
    @anon5992 7 หลายเดือนก่อน

    how can we utilize @error with this approach?

  • @christianhalaby832
    @christianhalaby832 7 หลายเดือนก่อน

    do you think not using signals at all is a set back?

  • @richard-scholten
    @richard-scholten 5 หลายเดือนก่อน

    Why Is It When Something Happens, It's Always You RxJS?
    Thanks, exactly the problem i was facing...

  • @svenson95
    @svenson95 7 หลายเดือนก่อน +1

    I don't really understand what you're doing in 1:50, the as const suffixes. What is happening there? it seems like the status property (a string) gets transformed to a variable / constant. I've never seen this before.

    • @RodrigoSalesSilva
      @RodrigoSalesSilva 7 หลายเดือนก่อน +4

      by default if you set a string to any variable the type will be infered as string, but if you use as const the type will be infered as the exact string, like "let a = 'authenticated' as const" the type of "a" will be infered as 'authenticated', otherwise it would be 'string'.

    • @svenson95
      @svenson95 7 หลายเดือนก่อน +2

      @@RodrigoSalesSilva okay interesting, but what is the benefit of having this status property not as type string but the actual value? In the next slide (2:01) we're just checking if the status value is "error", if i'm not wrong. Sorry if this is obvious, i feel kind of stupid right now :D

    • @JoshuaMorony
      @JoshuaMorony  7 หลายเดือนก่อน +3

      ​@@svenson95 this stream needs to return status values that match a union type of "initial | authenticating | authenticated | error", if I return just "error" for example it won't let me do that because type "string" is not assignable to that union type. If I use "as const" the specific string "error" does match that type.

  • @sergiokagiema9658
    @sergiokagiema9658 7 หลายเดือนก่อน

    Where are the 4 reads that procude 4 triggers ?

    • @JoshuaMorony
      @JoshuaMorony  7 หลายเดือนก่อน +1

      I think in the example the signal value is only actually referenced once, but it will depend on how many times change detection is triggered - so even if you only accessed the signal once in the template, but CD ran 4 times, it would cause 4 reads

    • @sergiokagiema9658
      @sergiokagiema9658 7 หลายเดือนก่อน

      I see, I got it! Thanks for clarifying it!

  • @leolanese
    @leolanese 7 หลายเดือนก่อน

    ...{rejectErrors: true}
    nice 👍

  • @dinysanchez
    @dinysanchez 7 หลายเดือนก่อน

    Thanks Joshua!