Remix Single: Optimistic UI

Поделиться
HTML-код
  • Опубликовано: 25 янв 2022
  • Instead of adding pending states and busy indicators while we wait for the server to process a mutation, we already know what the UI will look like when its done. Skip the spinners with Optimistic UI!
    Learn more at remix.run
  • НаукаНаука

Комментарии • 41

  • @inderdeepsingh3863
    @inderdeepsingh3863 2 года назад +7

    You are an absolute legend in the world of React. Soooo looking forward to Remix....!!!!!

  • @michaeldebetaz
    @michaeldebetaz 2 года назад +4

    Thanks a lot Ryan for these awesome videos 👌 After diving into Remix and liking it very (very) much, I decided to use it to build a production app for one of my clients (fully authenticated, so a pretty good case for SSR).
    I really love the way you teach and I would love to see more in the future. Keep up the great work!

  • @Greybph
    @Greybph 2 года назад +4

    Very much looking forward to Error Boundary video and all upcoming 👍

  • @kudorgyozo
    @kudorgyozo Месяц назад

    These videos are awesome. Thanks!

  • @KentCDodds-vids
    @KentCDodds-vids 2 года назад +12

    Grammerous 😆

    • @thmsrttg
      @thmsrttg 2 года назад

      Hello there.

    • @arjungoalset8442
      @arjungoalset8442 2 года назад +1

      Glad to be in your last advanced react live session today :) Your are my inspiration. Hope to be like you one day.

  • @youknowwho4994
    @youknowwho4994 Год назад

    Man, You nailed it. Remix & React-Router is awesome. One day i will sponsor to these open source projects when i am wealthy enough.

  • @NandoSangenetto
    @NandoSangenetto 2 года назад

    Amazing video.

  • @dani-mp
    @dani-mp 2 года назад +4

    Thanks for the video, Remix looks awesome and I can't wait to build production code with it.
    Something in this video that still doesn't feel great to me is that we have to use a custom object for the action error management. If we do that, then we probably want to wrap all our action responses in an object with a status property, so we can switch over success and failure, and then unwrap the actual "payload". But if we want to really leverage the platform, we already have error management backed in in both http and JavaScript, so what do you think it's the best approach here? It could be error boundaries, but as you said, maybe that's not the best tool for the job either?

  • @DEV_XO
    @DEV_XO 2 года назад

    Amazing! ❤

  • @chrisleyva
    @chrisleyva 2 года назад +1

    Love this video. Was the video recorded using Camo and your iPhone? Looks crisp!

  • @CathalMacDonnacha
    @CathalMacDonnacha 2 года назад +1

    Great video. Optimistic UI is ok when you have one or two fields, but I wouldn't fancy having to re-enter info into a long form submission that failed.

  • @willbannister7001
    @willbannister7001 Год назад

    This is awesome! Was wondering how to do this for my app

  • @AnhDung-of4wk
    @AnhDung-of4wk 11 месяцев назад

    i love your smiling bro

  • @eolculnamo2
    @eolculnamo2 2 года назад +7

    This is really cool.
    What would you suggest in a scenario where the server gets hung up until the request times out -- or any scenario where failure takes a long time. Seems like the user might see the name they just deleted pop back up 30-45 seconds later :)

    • @nadico5740
      @nadico5740 Год назад

      Or you need a redirect after submitting a form

  • @nadico5740
    @nadico5740 Год назад

    Hey Ryan, How would you go about combining optimistic ui and redirects, can you hook to the transition state in another route?

  • @bryanltobing
    @bryanltobing 2 года назад +1

    really great explanation :). could you please share your vscode configuration and theme?

  • @F39Productions
    @F39Productions Год назад

    What if a single form could have multiple in-flight requests at the same time if the value of any of the inputs is different? I feel like that would be the most elegant solution to avoid having to use useFetcher for optimistic add case you showed to not have to disable the Submit button while the previous add is still processing.

  • @stevebarakat6968
    @stevebarakat6968 2 года назад

    ✨✨✨✨✨✨
    ✨Thank You! ✨
    ✨✨✨✨✨✨

  • @nil7444
    @nil7444 2 года назад +1

    Any plans on sharing the repo or code?

  • @bryce_cee
    @bryce_cee 2 года назад

    Anyone with an idea what font is being used in the VS Code.

  • @nako0215
    @nako0215 11 месяцев назад

    Is a revalidate required for Optimistic as well?

  • @brimafreeman2765
    @brimafreeman2765 Год назад

    Please can you make Single about akimating page transitions between routes ! Please! I'm using Framer Motion.

  • @tshddx
    @tshddx 2 года назад +8

    15:36 How can I have multiple additions pending at the same time? If the form is driven by a fetcher.Form, then once you submit it, you'll need to check that fetcher's submission.formData to render the optimistic person, so wouldn't you need a *new* fetcher to allow the form to be submitted again? It's not clear to me where this unbounded list of fetchers (many still submitting, and one new one to allow another submission) would live. I'm guessing useFetchers (note the plural) comes into play.

    • @Remix-Run
      @Remix-Run  2 года назад +12

      That gets a bit tricky, probably too much for a YT comment reply :P Short version, handle form submissions yourself, shove formData into an array of react state, use that array to render components that have their own fetcher. It's harder than it should be, we think there's some room for improvement in the useFetcher API to not require so much footwork on the app's part.

  • @fowerthing9324
    @fowerthing9324 2 года назад

    Is it possible to share sample code ..?

  • @ahmedkhattak2937
    @ahmedkhattak2937 8 месяцев назад

    Whats the theme you are using here ?

  • @sagirorlich2042
    @sagirorlich2042 Год назад

    where can i find the sourcecode?

  • @ibrahimmohammed3484
    @ibrahimmohammed3484 2 года назад

    wowie

  • @tinmancode
    @tinmancode 2 года назад

    this optimistic ui would be cool but say there is a delete operation that for network and who knows what just becomes slow to tell us that the request failed but we removed the element optimistically then the user navigates to another page

    • @yarapolana
      @yarapolana 9 месяцев назад

      you could do a cron job for this case and retry the request there if it fails

  • @its4zahoor
    @its4zahoor 2 года назад +1

    At 15:40 "this is getting disabled too":
    Did you forget to remove disabled={isAdding} from Add button after clearing the conditional label? Or was it meant to keep the pessimistic UI? Which means if last item is adding, the button will be disabled and the new item can't be added.

  • @PeterKellner99
    @PeterKellner99 Год назад +1

    I don't now remix, but I'm wondering why for an optimistic UI you don't just make a quick copy of current state, update the state to the expected result, then on failure, reset to previous state. Seems like a lot less new code then all the extra stuff done in this video to handle the expected change. That is, no having to be concerned with specific data, just use the same logic as would be applied when a successful update happens.

    • @Daniel-vl8zm
      @Daniel-vl8zm Год назад +2

      I guess because why would you bother? This just adds more complexity, as you now have to manage a separate client state, and try and manually keep that in sync with the server. Just let remix handle it

    • @PeterKellner99
      @PeterKellner99 Год назад

      @@Daniel-vl8zm This was a while ago, but I thought I remember seeing that in Remix there was a ton of code to handle the optimistic UI, whereas on the client in JavaScript, very little code. That was my only point and why I would bother. I'm a lazy dev and less is more.

  • @nested9301
    @nested9301 Год назад

    iwas doing in this in react when i'm fetching data from firebase , iwas doing both approches and ididn't now that there is a name for them until i discover remix lol

  • @jamanshah1108
    @jamanshah1108 2 года назад

    Wajid Abbas

  • @devmnnu5334
    @devmnnu5334 2 года назад

    ×

  • @MaxTheFireCat
    @MaxTheFireCat 2 года назад

    how old are you?