[Phoenix LiveView Weekly] Issue #2 - Infinite Scrolling & LiveView Profiling
Welcome to the second edition of Phoenix LiveView Weekly!
Infinite Scrolling in LiveView
The ever-useful Phoenix Files on fly.io’s site has a new article about creating infinitely scrollable pages using LiveView. Love them or hate them, infinitely scrolling lists are a common requirement in web apps. Usually this involves JavaScript libraries and building a paginating API, but this post demonstrates how to use a simple LiveView hook to achieve a smooth result with some very simple code. The post also also clearly explains some LiveView behaviours such about double mounting and how to use temporary assigns.
Phoenix Profiler has been update to work with LiveView 0.18
I hadn't come across Phoenix Profiler before, but after installing it to one of my apps it seems like a useful tool for helping debug applications during development, letting you quickly see request & response info, response time, and quickly inspecting LiveView crashes. Definitely worth trying out.
Syntactic Sugar for :if and :for
Ben von Polheim notes something that I think a lot of people will have missed - LiveView 0.18 allows you to use :if and :for inside of heex tags rather than having to use <%= for ... do %> and <%= if ... do %>. This will clean up a lot of heex templates!
Phoenix LiveView Snippet Extension for Visual Studio Code
If you use VS Code as your code editor, you will likely find this extension very helpful. It provides an extensive list of code snippets for LiveView applications, saving you a lot of time typing in boilerplate code. After installing, just type 'plvs' and it will display the list of snippets.
Optimize Ecto's insert_all with Placeholders
Peter Ullrich has a handy tip for when you need to perform bulk inserts of data in to a database. Peter's blog contains loads of very useful posts about Elixir, Phoenix, and Ecto - it's well worth your time exploring his site.
DockYard Hiring Full-Time SwiftUI Engineer for LiveView Native
Brian Cardarella, the founder of DockYard, tweets that they are looking to hire a SwiftUI engineer to help build out LiveView Native. A fantastic opportunity to not only work an a very promising project, but to work with the incredible team at DockYard. It's exciting that them investing so much in the project.
That's all for this week.
If you have any feedback or tips, don't hesitate to get in touch via alan@phxlvweekly.com or @alanb on twitter.
Until next time!