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

    echoing-dress-67727

    02/13/2023, 9:31 PM
    I fixed that because it was causing me issues in my app. I'm hoping it can get reviewed and merged at some point soon
  • m

    mysterious-toddler-20573

    02/13/2023, 9:55 PM
    sorry, I'm really swamped right now
  • c

    careful-room-54859

    02/14/2023, 12:35 AM
    Hi everyone, I have question, I have noticed that HTMX is executing my
    <script>
    tag TWICE when I include one. Is this normal?
  • b

    best-fireman-79576

    02/14/2023, 7:05 AM
    How do I add markup to the page? e.g. on clicking a button, add a row to the table (without necessarily performing an AJAX request)
  • r

    refined-waiter-90422

    02/14/2023, 7:20 AM
    many ways: vanilla js jquery Basically non-ajax stuff is done with just normal js.
  • r

    refined-waiter-90422

    02/14/2023, 7:23 AM
    Oh and the classic
    onclick=""
  • g

    gifted-caravan-48512

    02/14/2023, 9:50 AM
    Hey everyone. I'm using htmx to open a prompt, followed by hx-confirm to confirm their input. Is there a way I can use their response to hx-prompt in the hx-confirm message? I know the response request includes the input as HX-Prompt, but not sure if it's possible for me to access that in the hx-confirm. Thanks
  • m

    microscopic-art-61410

    02/14/2023, 11:55 AM
    So, I thought I'd try to implement a simple ext to allow swapping in of just attributes, but not having much luck. Should I expect swapping extensions to work on hx-swap-oob? I've created an ext to just console.log...
    Copy code
    js
    htmx.defineExtension('attrs-swap', {
      isInlineSwap: function(swapStyle) {
        console.log("ATTRS-SWAP: isInlineSwap", swapStyle);
        return swapStyle === 'attrs';
      },
      handleSwap: function(swapStyle, target, fragment) {
        console.log("ATTRS-SWAP: handleSwap", swapStyle, target, fragment);
      }
    });
    and then loading the following fragment of html...
    Copy code
    html
    <li hx-ext="attrs-swap" hx-swap-oob="attrs:li.my-item" class="active"></li>
    but neither extension method appears to be hit, nothing is logged, but the element is still swapped. Am I doing something wrong, or is this not support with oob swaps?
    • 1
    • 3
  • l

    little-country-79193

    02/14/2023, 2:11 PM
    yes, if the old script is replaced with a new identical one, the new one will be executed. You can just add
    hx-preserve="true"
    on the script tag and it should stop re-rendering that script tag. If that doesn't work, exclude the script tag from the htmx response
  • m

    mysterious-car-3675

    02/14/2023, 4:23 PM
    Hi, new to htmx... trying to understand
    hx-trigger
    . From the docs it seems like the naming is not correct. The current
    throttle:1s
    is really a trailing throttle. Usually a throttle would trigger the event immediately but then ignore until the delay. RXJS actually has a lot of really useful options here. Looks like all the logic is at https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L1378-L1385 . I'm trying to move from a site that uses pretty heavy use of these different constructs. Is this something htmx users would be interested in or is it antithetical to the paradigm?
  • m

    mysterious-car-3675

    02/14/2023, 4:26 PM
    i'd also like to have a backoff version where if you get a 4xx status you exponentially backoff until a 2xx
  • t

    tall-dinner-62086

    02/14/2023, 4:29 PM
    > Usually a throttle would trigger the event immediately but then ignore until the delay. Yeah that's how it works in htmx too
  • m

    mysterious-car-3675

    02/14/2023, 4:30 PM
    ah perfect, i guess i wasn't reading the docs correctly
  • t

    tall-dinner-62086

    02/14/2023, 4:30 PM
    Yeah that would be neat. Rule 7b though.
  • m

    mysterious-car-3675

    02/14/2023, 4:32 PM
    7B... I must make a civil motion to the request a court order?
  • t

    tall-dinner-62086

    02/14/2023, 4:32 PM
  • m

    mysterious-car-3675

    02/14/2023, 4:33 PM
    cool, 7b it is... I just wanted to check if its even a PR that match the ethos
  • t

    tall-dinner-62086

    02/14/2023, 4:34 PM
    Someone implemented exponential backoff for websockets at some point
  • t

    tall-dinner-62086

    02/14/2023, 4:34 PM
    having it for other use cases sounds reasonable
  • t

    tall-dinner-62086

    02/14/2023, 4:35 PM
    for reference
  • m

    mysterious-toddler-20573

    02/14/2023, 4:36 PM
    in general I wouldn't mind thinking about making retry strategies pluggable
  • m

    mysterious-car-3675

    02/14/2023, 4:36 PM
    so if i'm reading the defineExtension correctly this would be a onEvent, there doesn't seem to be a transformRequest, just transformResponse hook
  • m

    mysterious-car-3675

    02/14/2023, 5:01 PM
    is it valid to use defer or async on the htmx cdn script tag?
  • m

    mysterious-toddler-20573

    02/14/2023, 5:08 PM
    it should work, w/ the caveat that if you are including extensions then you probably want a reliable ordering
  • m

    mysterious-toddler-20573

    02/14/2023, 5:08 PM
    also, behaviors might not work quite right until the script loads
  • m

    mysterious-toddler-20573

    02/14/2023, 5:08 PM
    generally I don't think the savings is worth it, but ymmv
  • c

    clean-piano-67951

    02/14/2023, 11:08 PM
    Hello! I am having an issue using a TailwindCSS plugin called Flowbite. It has a JS script that can be used with its components. I have got a toggle element that works when the page is loaded on its own. However, the JS doesn't work when the div is loaded by HTMX. Even though, it is correctly in the source etc.
  • c

    clean-piano-67951

    02/14/2023, 11:08 PM
    it is a similar issue to this: https://github.com/bigskysoftware/htmx/discussions/1158
  • c

    clean-piano-67951

    02/14/2023, 11:09 PM
    However, I don't understand JS that well at all, so I was wondering if someone could give me a pointer!
  • m

    mysterious-car-3675

    02/15/2023, 2:57 AM
    my guess is the load is removing the event listeners flowbite sets up... i'd look at the morphdom ext
1...101910201021...1146Latest