Wondering about the new :let and friends

I know the answer is around the corner but figured I’d ask (and surprised I can’t find it in the forum already).

What’s with the new :let, :for and :if? I read about them many weeks ago in the changelog, but no reason was given as to the change. What I’ve inferred is that they denote “global” attributes, or I guess could be “special” attributes made available by the framework on (any?) component. Is this true? Now that I’m writing it out it feels like it’s probably true (or partially true), but I’m just looking for some confirmation.

2 Likes

I read this today. Maybe it helps clarify?

7 Likes

The documentation for :let/:if/:for attributes under Phoenix.Component.sigil_H/2 is a good place to start - but that definitely wasn’t the first place I thought to look.

On the other hand, global attributes are a different thing that’s also very new.

2 Likes

Yep, that certainly helps, if not fully answers my questions. If only there was some sort of technology that could “aggregate” blogs I read that would have alerted me to this post made one day ago :upside_down_face:

Thanks, James! :heart:

Also, if the author of this post is reading, there are some syntax errors when around when you introduce :for. I should probably use some other technology to alert you of this (like “email” or something).

Ya, “global” was very much in quotes—I didn’t think to re-read the ~H documentation.

My goto for new stuff is always a project’s changelog. I learned about verified routes (~p) a while ago from the Phoenix changelog which went into solid detail about what they were all about. I also learned about :for from the changelog yet in this case it had exactly zero detail on the change, not even any examples. It just stated that let becomes :let with no context. In my mind I wasn’t totally sure that that was literally just prefixing a : on the attribute and not something else entirely different.

This is probably an XY problem and I should be asking: How do you keep up with Phoenix development and help document new things? Now that I’m saying that out loud, I’m guessing it is probably the mailing list… is it? Is there somewhere else?

3 Likes

You just need to watch the GitHub repo(s) to read all the PRs and issues, read all the posts on here, read all the newsletters and blog posts, and monitor Slack and Discord.

6 Likes

That article mentions how you can’t combine :let and :if on the component slot call in that nice way shown in the article. I wonder, is that something that will change in the future?

Excited to use that new syntax instead of writing out all the if…do…end blocks in html.

Thanks for sharing this, and great article @SophieDeBenedetto thank you!

3 Likes

Oofa, that sounds exhausting. I prefer the changelog / release notes and hope they have links… :grimacing:

haha :sweat_smile:

To be be extra clear, (and this isn’t really responding to you, @cmo), I’m not criticizing anyone on the team of people who makes this 100% free software I use all the time and have made a bunch of money off of, it’s just been a thing I’ve noticed for a while now and was thinking on how it could be improved.

Part of my confusion is the LiveView vs Phoenix releases and how heex crosses the boundary and I forget what changelog I’m reading and don’t think to check the updated docs. I do realize that we are in a bit of a limbo state where the new LiveView is out but the new Phoenix isn’t.

Anyway, that’s my little ramble!

4 Likes

That’s interesting to see that this article is from the author of the book Programing Phoenix LiveView @SophieDeBenedetto

So I wonder if she’s intending to update the book with all these new features?

Just noticed a new release of the Beta book (B8.0) but it seems to only handle some errata.

Does anyone know if the book will actually cover the latest version of LiveView and if so if there’s an estimated time for the release?

PS: The release date stated is October 2022, but I’m genuinely asking here since I’m not sure those release dates displayed in beta book descriptions are reliable and also because when I look here and in devtalk there’s not much update on the book which is really highly anticipated for sure!

1 Like

Indeed, if this book will be released as it is now, it will be already (partly) obsolete. Of course, it is the best existing source to learn liveview (imho).

I just got an email to notify me that the book is now in version programming-phoenix-liveview_B8.0, the previous version being programming-phoenix-liveview_B7.0.

So I think the book will probably be updated with each major version of LiveView until we reach the stable version.

Unfortunately searching the keywords :if, :for in the new version of the document didn’t show any result, but I think this is not a big deal. Anyway I will read again the book from the begining.

I got confused a bit, so I stopped learning and implementing new stuff, till Phoenix 1.7 is out.

I just learnt few stuff, and they are already outdated.

I’m having trouble piecing things together, so I got overwhelmed.

3 Likes

You don’t need to wait, You can use Liveview 0.18 with Phoenix 1.6

1 Like

I will soon die if I have to keep up with the Elixir & Phoenix news like that. :sweat_smile:

Yes I know, but the generators are not updated to output Tailwind CSS.

New features are not added, like that new Notification pop up.

And I don’t know how many more.

I was going to implement some of the features showcased and now I won’t have to.

I’m waiting for those.

Meanwhile I will learn Elixir and OTP.

Only LiveView and Phoenix is on hold.

2 Likes

That part is more stable…

1 Like

Don’t forget attending all Elixir conferences.

Hehe, I have watched all ElixirConf videos btw!!

Hello! Yes we intend to update the book once LiveView hits 1.0. At that time, we’ll do a round of revisions to capture all of the new features.

We don’t have an ETA on that unfortunately since there is not timeline published for LiveView at this time.

3 Likes