https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • r

    refined-pillow-25368

    05/25/2023, 6:17 PM
    Thank you!
  • a

    abundant-dog-96915

    05/26/2023, 3:22 AM
    HTMX on orange site again
  • m

    mysterious-toddler-20573

    05/26/2023, 3:22 AM
    it'll get nuked, but htmx is at the top of HN again
  • m

    mysterious-toddler-20573

    05/26/2023, 3:23 AM
    top comment:

    https://cdn.discordapp.com/attachments/725789747212976259/1111494721697751050/image.png▾

  • b

    bitter-machine-55943

    05/26/2023, 3:31 AM
    I dunno guys. One HN user claims HTMX isn’t a silver bullet. So.
  • m

    mysterious-toddler-20573

    05/26/2023, 3:33 AM
    SOURCE!?!?!
  • b

    bitter-machine-55943

    05/26/2023, 3:35 AM

    https://cdn.discordapp.com/attachments/725789747212976259/1111497807921152020/IMG_1541.png▾

  • b

    bitter-machine-55943

    05/26/2023, 3:35 AM
    Does this mean the discord is getting shut down?
  • m

    mysterious-toddler-20573

    05/26/2023, 3:41 AM
    deleting it all lads
  • f

    few-parrot-58207

    05/26/2023, 4:00 AM
    No more werewolf hunting for you
  • g

    gentle-finland-44476

    05/26/2023, 4:38 AM
    Hi all - I am building a chat program. I have HTMX OOB swaps coming over a websocket. Trying to update the sidebar when a new message comes in without sending the entire sidebar again. Sidebar starts like this
    Copy code
    <div id="sidebar">
        <div id="conversation2">message 2</div>
        <div id="conversation1">message 1</div>
    </div>
    I want it to look like this after a new message comes in
    Copy code
    <div id="sidebar">
        <div id="conversation1">message 3</div>
        <div id="conversation2">message 2</div>
    </div>
    However using hx-swap-oob="afterbegin", it becomes
    Copy code
    <div id="sidebar">
        <div id="conversation1">message 3</div>
        <div id="conversation2">message 2</div>
        <div id="conversation1">message 1</div>
    </div>
    I need to update the element conversation1 and push it to the top of the sidebar elements. Is there an HTMX way to do this or do I need to introduce some custom JS?
  • m

    miniature-window-68019

    05/26/2023, 5:12 AM
    dang this hn htmx thread is a lot worse than the previous one
  • m

    miniature-window-68019

    05/26/2023, 5:14 AM
    a lot of confusion over simple things like what hyperscript is or hypermedia in general
  • g

    great-article-50141

    05/26/2023, 5:28 AM
    I agree, this time HN brought some of their more idiotic people to the front on this thread.
  • t

    thankful-balloon-21810

    05/26/2023, 7:39 AM
    considering the HOWL stack, it might be better that htmx is not a silver bullet, though.
  • t

    thankful-balloon-21810

    05/26/2023, 8:28 AM
    Supreme

    https://cdn.discordapp.com/attachments/725789747212976259/1111571522134495324/9b2f034b825c9aa9a994b92b7c8f393c.png▾

  • f

    famous-iron-45600

    05/26/2023, 9:04 AM
    Is there any way to listen for websocket events, like
    server-sent-events
    extension does? It seems only sending form data is currently supported. Is that right?
  • t

    thankful-balloon-21810

    05/26/2023, 9:05 AM
    There is an extension for websockets: https://htmx.org/extensions/web-sockets/
  • f

    famous-iron-45600

    05/26/2023, 9:10 AM
    thx, I'm using this ext, but it doesn't provide listening to websocket events if I'm not mistaken.
  • r

    ripe-action-67367

    05/26/2023, 9:32 AM
    The thing is, websockets don't have events like SSE does, they aren't part of a protocol. If you want events, make them part of your message, set up a custom event listener for beforeMessage event (https://htmx.org/extensions/web-sockets/#htmx:wsBeforeMessage) and raise your own custom events
  • r

    ripe-action-67367

    05/26/2023, 9:34 AM
    Even simpler, you can filter beforeMessage event with
    hx-trigger="htmx:wsBeforeMessage[message.event=='myEvent']"
    , which may not be as clean, but requires zero custom JS
  • b

    bitter-monkey-50309

    05/26/2023, 11:28 AM
    I think a lot of people see htmx and think you've got to use it for everything. Is it worth putting a small header on the main page "when NOT to use htmx?" that summarises and links to the when to use hypermedia essay?
  • b

    bitter-monkey-50309

    05/26/2023, 11:46 AM
    I'm thinking of comments like this where it seems people think it's htmx or nothing, when really it should be "don't write JS unless you need to"

    https://cdn.discordapp.com/attachments/725789747212976259/1111621348981219348/image.png▾

  • m

    mysterious-toddler-20573

    05/26/2023, 12:13 PM

    https://cdn.discordapp.com/attachments/725789747212976259/1111628086182686790/iu.png▾

  • t

    thankful-balloon-21810

    05/26/2023, 12:13 PM
    It's a pattern of not just misunderstanding things, but getting them conceptually wrong. Unfortunately, even explaining it will lead these people to the wrong conclusion as long as the underlying misconception isn't identified and resolved.
  • m

    mysterious-toddler-20573

    05/26/2023, 12:14 PM
    my impression is that a lot of folks scan until ackshully, and additional explication will be of little use
  • m

    mysterious-toddler-20573

    05/26/2023, 12:14 PM
    (I am guilty of this myself, let he who is without sin cast the first stone!)
  • s

    sparse-musician-64201

    05/26/2023, 12:15 PM
    They already decided what their opinion was going to be before reading the post, and then just looked for some words that could tangentially mash together to justify it, even if the resulting sentence isn't even sensible.
  • m

    mysterious-toddler-20573

    05/26/2023, 12:15 PM
    it got 300+ upvotes before it got nuked and the top comment now is a reference to the memes page, so I'm calling this a win
  • s

    sparse-musician-64201

    05/26/2023, 12:15 PM
    You find these people in real life also, I work them, the key is to identify and avoid, nothing good comes out of engaging.
1...114111421143...1146Latest