Optimistic UI in Remix

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

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

  • @laptopuser5198
    @laptopuser5198 10 หลายเดือนก่อน +3

    High Quality content. Keep the remix coming.

  • @martinemanuel8239
    @martinemanuel8239 9 หลายเดือนก่อน +1

    Remix is such an amazing framework kudos for the project

  • @adiadiadi
    @adiadiadi 8 หลายเดือนก่อน

    I'd often get tripped up by the useFetcher API in Remix. This helped deepen my understanding.
    thank you Sam!

  • @Gileno
    @Gileno 8 หลายเดือนก่อน +2

    Great video. Deep enough to understand how optimistic ui on Remix works... It would be nice if you could show how to handle errors on optimistic ui as well. Thanks.

  • @saurabh75prakash
    @saurabh75prakash 5 หลายเดือนก่อน

    Great tutorial on Optimistic UI and fetchers, thanks.

  • @planetmall2
    @planetmall2 9 หลายเดือนก่อน

    Seriously one of the best learning videos I have seen. I really appreciate this.

  • @VitorJustin
    @VitorJustin 10 หลายเดือนก่อน +1

    Thanks for the lesson, Sam. Great content as usual.

  • @vaibhavshringarpure8570
    @vaibhavshringarpure8570 10 หลายเดือนก่อน +1

    Hi Sam - Yet another great video. Nothing less can be expected from this channel.. You always try to explain it very nicely and easy to understand. Thanks for doing it. Appreciate it. Also wanted to say here that all your demo UI looks really sleek and thought-after... how do you come up with these project ideas and nice clean UI.. perhaps a video on how to approach a project from concept to final would be good to get some insights please. Thank you

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +2

      Thanks for the kind words! The best advice for getting better at the design side of UI is to practice + recreate well-designed interfaces. Build up your taste over time and focus on the details. Refactoring UI helped me a lot here! I also spend about an hour in the Remix course on redesigning the Work Journal covering some design best practices along the way: buildui.com/courses/ship-an-app-with-remix/mobile-redesign
      Maybe I'll add some videos here on the topic if folks are interested!

    • @vaibhavshringarpure8570
      @vaibhavshringarpure8570 10 หลายเดือนก่อน

      Thank you kindly Sam

  • @anth0ni33
    @anth0ni33 3 หลายเดือนก่อน

    The useFetcher singleton approach has its applications. E.g.: When clicking a like button, you don't want it to send all the requests, you want just the last input.

  • @rodolphobravo298
    @rodolphobravo298 10 หลายเดือนก่อน

    Great video as usual, Sam!

  • @simonpoudyal2293
    @simonpoudyal2293 10 หลายเดือนก่อน +4

    Hey, in your future videos, is it possible to show your keypresses on screen? Recently started learning vim motions and the way you navigate the text is beautiful. Maybe could get some tips from just watching you code.

    • @DioArsya
      @DioArsya 10 หลายเดือนก่อน

      yuppp🎉

  • @codebulls7943
    @codebulls7943 9 หลายเดือนก่อน

    You are a beast sir

  • @eleah2665
    @eleah2665 9 หลายเดือนก่อน

    A lot going on there. Remix = good.

  • @amirnoorani5017
    @amirnoorani5017 10 หลายเดือนก่อน +2

    Sam could you make a video about Why remix? I saw in some of your videos you use remix. Is it better than Next.js?

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +6

      Good idea! Remix feels more stable to me at the moment, but I really like both frameworks. I'm really excited about Server Components + Server Actions in Next.js, but the current caching defaults feel complicated. Maybe I will make a video talking about it!

    • @amirnoorani5017
      @amirnoorani5017 10 หลายเดือนก่อน

      @@samselikoff thanks. That would be great because there is little information on Remix

  • @DivjotSingh
    @DivjotSingh 10 หลายเดือนก่อน

    Reassigning entries just kinda broke my mind. Of course you should be able to do it, the entries would be reassigned when the data from the backend comes anyway, but somehow the push to always use const made it unintuitive for me.

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +2

      I think const is overused :) Local reassignment is extremely handy (and safe) in JS!

  • @SinhNguyen-tz6us
    @SinhNguyen-tz6us 10 หลายเดือนก่อน

    Hi Sam, great video as usual. I have some quetions:
    - How will you do optimistic UI when there is error? (like network error or 4xx error when POST)
    - Instead of optimistic UI, what If I want to show a toast to inform the user, how will you do it? Currently I'm thinking of using the session but it seem too much for me.
    Thanks in advanced.

    • @samselikoff
      @samselikoff  9 หลายเดือนก่อน +2

      I think I'll have to make a follow-up to show how to do error handling since plenty of folks are interested in it!
      For the Toast I would use Radix Toast (or one of the other headless UI libraries), I actually just shared a code demo for one here: buildui.com/recipes/animated-toast. You'd need to call the showToast method whenever you want one to show up. Shouldn't need the session. In your example, when do you a toast to show up? After each item is saved, or after all pending items are saved?

    • @SinhNguyen-tz6us
      @SinhNguyen-tz6us 9 หลายเดือนก่อน

      @@samselikoff wow, thanks for your reply. In my example, I want to show the toast after each item is saved.

    • @samselikoff
      @samselikoff  9 หลายเดือนก่อน +1

      @@SinhNguyen-tz6us You're welcome! In that case you should be able to just call the `showToast()` method from the recipe I linked to after you call `submit()` on the form! You can also use a library like React Hot Toast if you don't need as much control over styling/position/animation.

    • @SinhNguyen-tz6us
      @SinhNguyen-tz6us 9 หลายเดือนก่อน

      @@samselikoff Thank you, again.

  • @muhammadbinjamil9998
    @muhammadbinjamil9998 10 หลายเดือนก่อน +2

    How do you handle optimistic UI in case of a failure, say a network error?

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +1

      Was thinking of making a follow-up if enough folks asked this - sounds like it might be worth it!

  • @samiullahsheikh5015
    @samiullahsheikh5015 3 หลายเดือนก่อน

    How to revert back if data failed to save in database?

  • @jon1867
    @jon1867 8 หลายเดือนก่อน +1

    I have to say, I find doing optimistic UI in remix not that fun for more complex stuff than this. It feels like trying to shave down a square peg to fit in a round hole.

  • @shadowfaxenator
    @shadowfaxenator 10 หลายเดือนก่อน

    What's about redirect from action? Otherwise if you click back button you'll post again. And especially if no JS you should redirect to revalidate

  • @drewhjava
    @drewhjava 9 หลายเดือนก่อน

    Serious question, is it tough for you to give tutorials for things that Ember could do 40 years ago? I'm digging Remix over Next for sure.

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

      Haha there are def some places where Remix is still catching up but overall I'm liking working with lower-level tools these days

  • @gamehelp16
    @gamehelp16 10 หลายเดือนก่อน +1

    Are there any security concerns by letting the client side determine the id of the entries?

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +4

      Nope, assuming your backend (1) has standard validation logic against creating records with duplicate IDs (uniqueness constraint on the database), and (2) doesn't expose any sensitive information based on the client knowing a record's ID (which is typically covered by auth logic in loaders/actions already, since exposing resource IDs is a common way to build web apps)!

    • @KenMarfilla
      @KenMarfilla 10 หลายเดือนก่อน +1

      The reason ID is needed in the video is because it is needed to render the edit link. If you make the edit link render conditionally, you don't need to ID in advance. The revalidation will take care of eventually producing the ID.

    • @gamehelp16
      @gamehelp16 10 หลายเดือนก่อน

      @@samselikoff Do you have any tips on how to handle if a collision in the ID were to ever happen?

    • @samjohnston3416
      @samjohnston3416 10 หลายเดือนก่อน

      ⁠@@gamehelp16with UUIDs this has a VERY slim case of happening were talking 2+ quintillion records for it to even have a chance of happening (according to Wikipedia)

  • @codewithnws3544
    @codewithnws3544 8 หลายเดือนก่อน

    Can you give us the code link, repo to this project!

  • @udaym4204
    @udaym4204 6 หลายเดือนก่อน

    remix vs next js what is diffrent

  • @volumepunch
    @volumepunch 10 หลายเดือนก่อน +1

    What happens if the server returns an error? Will the item stays in the list or will it be removed?

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน

      I think I'll make a quick follow-up to address it!

  • @predaytor
    @predaytor 10 หลายเดือนก่อน

    What's that vscode theme? Looks like a bit darker Dracula theme😯
    Thx.

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +2

      Yep, Dracula with a few tweaks to match slate-900 from Tailwind. Just threw it up in a gist: gist.github.com/samselikoff/7a79b5363f87b838b88025ba992835c5

    • @predaytor
      @predaytor 10 หลายเดือนก่อน

      @@samselikoff❤

  • @oscarljimenez5717
    @oscarljimenez5717 10 หลายเดือนก่อน

    Great video, but i still don't understand why people use let over const 😐

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +1

      fewer characters to type :P
      also overreacted.io/on-let-vs-const/
      but really I could care less, I might switch to const soon just so it's not a distraction

    • @baldcoder_
      @baldcoder_ 10 หลายเดือนก่อน

      Is this debate still a thing? It doesn't matter what you use as long as you're not using var.

  • @polyander
    @polyander 10 หลายเดือนก่อน

    please more next.js & framer motion

    • @samselikoff
      @samselikoff  10 หลายเดือนก่อน +1

      👍 what framer motion stuff do you want to see?