How do I call a js function after an htmx element gets swapped in (afterSwap)?
I'm not familiar with flowbite, so can't say if this is a proper solution, but you could listen for an htmx:afterRequest event for the button in question, then call initFlowbite() when it's received. If you're using hyperscript it could be something like <button [...] _="on htmx:afterRequest js initFlowbite() end">...</button>
or hm maybe you need it to be htmx:afterSwap and listen for the event on the huge list being swapped in, again not sure exactly what the needs of flowbite are
Ah, ok… the hyperscript htmx was what I was missing… this could be a game changer for me as it opens up all the htmx functionality.
@me1621 This worked perfectly!! Thank you!
Glad to hear! I’ve only just started playing with hyperscript myself, but I’ve been pretty pleased with it so far. Btw I’d recommend the https://hypermedia.systems/client-side-scripting/ of the htmx https://hypermedia.systems/ book if you want a good intro to the topic. The whole book is worth a read really (although you can probably skip the mobile app/hyperview section unless you care about that)
you'd probably need to add an event listener to the htmx:afterSwap event kinda like this example (except not the config event ofc) https://hypermedia.systems/tricks-of-the-htmx-masters/#using-the-htmx-configrequest-event
As usual, I should have just stated my actual problem. A button replaces the main area of my SPA with a huge list… and of course the Tailwind/Flowbite library has already loaded. So I need to run initFlowbite() after the list swaps into the target div, so it’s all styled correctly. Your advice may be the same, but I should have just asked this initially.
How does biff determine whether to print an email to the console vs actually sending it? I just registered with mailersend, and have MAILERSEND_FROM and MAILERSEND_API_KEY assigned in config.env. I've restarted app, but I still get the sign-in link printed to the console.. and mailersend is also saying that no emails got sent. If I use curl however (as per https://www.mailersend.com/features/email-api), I am able to trigger a send (and now mailersend reports 1 sent and delivered email), so it looks like it's not an issue with my mailersend setup.
nvm I decided to do a search in the source.. and came across the note in home.clj about needing to have keys for both MailerSend... and reCAPTCHA as well. Will work on that, and then come back if I still have issues.
fwiw i also ran into this issue
might be worth printing a warning or something
as in u only had MailerSend set up but not reCAPTCHA?
yeah
i did implement that warning a while back, mb i forgot to pr it or something
yeah, it isnt exactly clear
if you could check that'd be great
I threw the code away cus i thought it was dumb and wouldn’t be useful to other people 🤦🏻♂️
might be a good pr for u tho :^)
🙂 haha
😉 there is this already: https://github.com/jacobobryant/biff/blob/c0cf90a074ed3595d7c9cd62b7480bba437cc66d/starter/src/com/example/email.clj#L80. Would tweaking that in some way solve the problem? e.g. making it more prominent with ascii art or something. If not, another option could be to add an info box to the web app UI (maybe just on the landing page?) that lists out the config keys you still need to add.
ah, thank you for that! I saw that line in my early days, but have since forgotten. After that, it's been all about looking for the verify link if I look, and skipping the rest of the text of the email as "part of the template" in my mind. Yes, it would be good to make it more prominent in some way.