Fork me on GitHub
#biff
<
2022-12-30
>
Epidiah Ravachol16:12:38

While working through the tutorial, on https://biffweb.com/docs/tutorial/communities/ I came upon this code in the app-page function in com.eelchat.ui:

[:option {:value "/app"
          :selected (when (= uri "/app"))}
       "Select a community"]
I thought there might be a missing part to that when form, but everything is working, so now I'm wondering if maybe it's a trick to remove the selected attribute when not on a specific community's page. Or maybe I'm over thinking it.

Jacob O'Bryant19:12:11

Huh, that definitely looks like a mistake on my part. I think it works because the value of :selected for all the subsequent options is set correctly.* And if none of those options are selected, then this first one is selected by default. I'll update that code snippet. *or at least, more correctly... even there it should probably be :selected (when (= url uri) "true") instead of :selected (when (= url uri) url), at least for style.

👍 1
Epidiah Ravachol19:12:00

Good to know. My instincts on these things are as often wrong are they are right.

🙂 1