LiveView JS: The Comprehensive Guide

Поділитися
Вставка
  • Опубліковано 26 вер 2024

КОМЕНТАРІ • 24

  • @aviagarwal3011
    @aviagarwal3011 3 дні тому +1

    Excellent overlap of introductory information and high-quality production!

  • @ignasiespi
    @ignasiespi День тому +1

    really good! the repo is super useful as well. Thanks :)
    as suggestions for future videos I'd be interested in phoenix streams or forms, in case it helps

  • @olafurbjarkibogason7148
    @olafurbjarkibogason7148 3 дні тому +2

    Thank you for all the great tutorials. Would you prefer doing it this way for future applications opposed to bringing in something like livesvelte?

    • @CodeAndStuff
      @CodeAndStuff  3 дні тому +1

      I'm glad you've enjoyed the videos!
      It depends.
      I'd choose livesvelte or inertia if the project strictly requires a library that only plays well with a framework like Svelte or React, or if the team working on it has deep experience with those frameworks and timelines are tight.
      The best stack is the one that a team is most productive with, and tradeoffs are unavoidable.
      That being said, you can get a ton out of the box with LiveView JS-bailing out to hooks when / if needed. I'd definitely recommend trying out a LiveView-first approach and seeing if it meets your needs, knowing you have options.

  • @reinettetinekerr219
    @reinettetinekerr219 3 дні тому +4

    Are you hacking my brain? How do you always know what I want to know 😅

  • @TheTwyker
    @TheTwyker 3 дні тому +1

    this is so fucking cool, thanks man!

  • @webspaceadam
    @webspaceadam 3 дні тому +1

    this is awesome. great job

  • @juliolinarezescobar
    @juliolinarezescobar 3 дні тому +1

    Awesome project.

  • @QuentinDurot
    @QuentinDurot 3 дні тому +1

    Thank you so much!!

  • @solvm1652
    @solvm1652 2 дні тому

    🔥

  • @guglielmobartelloni
    @guglielmobartelloni 3 дні тому +3

    Yours are the best tutorials on elixir man.
    I would really love to work with elixir instead of java :(

    • @CodeAndStuff
      @CodeAndStuff  3 дні тому +3

      Thanks! I’d love to write Elixir at work too, but companies love their JS, Python, Ruby, etc…
      Some day Elixir will catch on!

  • @尼古拉丝土豆
    @尼古拉丝土豆 2 дні тому

    LV makes JS front-end more chaotic

  • @Ketupia
    @Ketupia 3 дні тому +2

    at 12:47 you make the comment that the next version of phoenix won't include a modal by default. Where can I read more about that plan?

    • @CodeAndStuff
      @CodeAndStuff  3 дні тому

      x.com/rootcert/status/1836035549377003551

    • @CodeAndStuff
      @CodeAndStuff  3 дні тому

      github.com/phoenixframework/phoenix/pull/5900

  • @whit6119
    @whit6119 День тому +1

    Great video! I have been looking into LiveView JS functionality to see if these pieces you show could be used for optimistic UI updates. Can those JS commands you show respond to the server? and could they be used for this use case shown in this video from time 3:05:26 ua-cam.com/video/jXyTIQOfTTk/v-deo.htmlsi=QrgTSO9dm-A47jf9&t=11126 Or would you need to use something like Live Svelte?

    • @CodeAndStuff
      @CodeAndStuff  19 годин тому +1

      That's a bit of a tricky one.
      There's some documentation on optimistic UIs in the liveview docs (here: hexdocs.pm/phoenix_live_view/syncing-changes.html), but it doesn't directly cover the optimistic create use case.
      If you strictly want the exact same behavior as that tutorial-updating the UI with a page-local state-you probably should use something like Live Svelte or build a traditional SPA (but you can still use Phoenix Channels with it to make the comms go over a websocket and enable server-to-client push).
      Technically, this could be written as a phx hook, but I imagine it'd be more complicated than it would be worth.
      If your requirements are a bit more flexible, look at async assigns (docs: hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-async-operations). In my experience, most of the time spent waiting for a create operation isn't a result of a slow network link. With async assigns, you can create a placeholder assignment on the socket with a loading and error state. The server can immediately push a patch to the page to show a loading indicator or optimistic item in a table, then when the processing finishes it can patch to look like a complete entry.
      I'm considering making a video on async assigns in the future because it's a pretty interesting solution to things like this. Let me know if you end up pursuing any of these paths!

    • @whit6119
      @whit6119 5 годин тому

      @@CodeAndStuff Thanks so much for the reply and info. I will look into the info you have provided. I would love to see a video on the async assigns. I am wondering if there are ways to make live view sites feel as snappy as SPAs. I find navigating live view sites a bit slow compared to spa.

  • @RicoTrevisan
    @RicoTrevisan 14 годин тому

    Excellent. Why no modal in the next version of Phoenix?

  • @ashrodan
    @ashrodan День тому

    Why the decision to use inline render method and not have the dom elements in heex files?

    • @CodeAndStuff
      @CodeAndStuff  День тому

      It just simplifies the visuals for teaching.