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

    miniature-lizard-24702

    09/18/2022, 11:50 AM
    I've seen shoelace before, it looks good
  • g

    green-army-74971

    09/18/2022, 11:59 AM
    hey, is there an event that htmx emits on all errors? i have kind of generic error-displaying function that i want to run if any htmx req fails. is there one single one that i can catch, or do i need to catch individually htmx:sendError, htmx:responseError, etc?
  • m

    mysterious-toddler-20573

    09/18/2022, 2:16 PM
    htmx:error
  • g

    green-army-74971

    09/18/2022, 3:02 PM
    does discord have a slapping-own-forehead emoji? thanks. (didn't see it on https://htmx.org/events/ though, fwiw.)
  • a

    adamant-state-54102

    09/18/2022, 3:42 PM
    @mysterious-toddler-20573 Does this strategy sound reasonable to you or am I missing something simpler?
  • m

    mysterious-toddler-20573

    09/18/2022, 3:50 PM
    unfortunately if you want to avoid the spinner flash, that's probably the best way
  • m

    mysterious-toddler-20573

    09/18/2022, 3:50 PM
    if you log a bug we can think about not removing the spinner when we get a redirect
  • a

    adamant-state-54102

    09/18/2022, 3:56 PM
    Thanks. There might be an even better approach, but one improvement I was thinking about is if there was something like a
    htmx:redirectReceived
    event, then I could handle that by keeping the overlay. This has the advantage of not spreading the logic across both server and client for this particular feature (ie, server would be able to redirect as normal, not worrying about the client experience with trigger headers, and all the logic is on the client, albeit in the form of both an hx-indicator property and an event handler.
  • m

    mysterious-toddler-20573

    09/18/2022, 3:57 PM
    I think you could achieve this w/ a custom event
  • m

    mysterious-toddler-20573

    09/18/2022, 3:57 PM
    i guess the problem is that the redirect is conditional
  • m

    mysterious-toddler-20573

    09/18/2022, 3:57 PM
    so if redirect do not remove indicator, otherwise do
  • m

    mysterious-toddler-20573

    09/18/2022, 3:57 PM
    kinda hard w/o some deep integration w/ htmx
  • a

    adamant-state-54102

    09/18/2022, 4:00 PM
    A more systemic solution would be adding a config so you could write something like (this syntax isn't right but you get the idea):
    hx-indicator="#overlay keepOnRedirect
    . I'd guess the pattern is probably reasonably common that it could be justified, but I don't know.
  • r

    refined-pillow-25368

    09/18/2022, 8:34 PM
    Anyone tried https://barba.js.org/ with hmtx? Just saw it on hn
  • a

    ancient-shoe-86801

    09/18/2022, 11:05 PM
    Here it goes. I ended putting it near the end with things like security, as it is more a "yeah, everything works out of the box according to HTTP standards" rather than something htmx specific. https://github.com/bigskysoftware/htmx/pull/1049
  • b

    boundless-rocket-26534

    09/19/2022, 9:07 AM
    thank you @mysterious-toddler-20573! Good advice, I was wondering where it's acceptable to post stuff related to htmx :). Will do so.
  • p

    proud-librarian-99598

    09/19/2022, 1:30 PM
    How can I trigger a GET with 2 request parameters that are coming from 2 inputs? I tried this:
    Copy code
    <div hx-swap="none">
                <input id="date-range-from"
                       type="date"
                       name="fromDate"
                       th:value="${fromDate}"
                       hx:get="@{/batches-table}"
                       hx-params="fromDate,toDate"
                >
                <input id="date-range-to"
                       type="date"
                       name="toDate"
                       th:value="${toDate}">
            </div>
    But that does a request with only the
    fromDate
    , not the
    toDate
    from the other input.
  • f

    freezing-waitress-26396

    09/19/2022, 1:41 PM
    hx-include="closest div"
    on the first
    input
    ?
  • p

    proud-librarian-99598

    09/19/2022, 1:51 PM
    Perfect, thanks!
  • e

    echoing-dress-67727

    09/19/2022, 4:08 PM
    Is it possible to set the encoding with
    htmx.ajax
    ?
  • m

    mysterious-toddler-20573

    09/19/2022, 4:22 PM
    it doesn't look like it currently, although you should be able to catch
    htmx:configRequest
    and override the
    Content-Type
    header
  • e

    echoing-dress-67727

    09/19/2022, 4:41 PM
    Okay, I'll try that
  • e

    echoing-dress-67727

    09/19/2022, 5:35 PM
    In my codebase, that proved to be tricky. Would you accept a PR to allow for changing this? https://github.com/bigskysoftware/htmx/pull/1050
  • e

    echoing-dress-67727

    09/19/2022, 5:41 PM
    Scratch that. Here's the PR: https://github.com/bigskysoftware/htmx/pull/1051
  • a

    ancient-shoe-86801

    09/20/2022, 1:29 AM
    I just noticed I am getting a favicon request for every request and is bothering me
  • a

    ancient-shoe-86801

    09/20/2022, 1:29 AM
    and the responses to these requests are fragments that do not have a favicon link on them
  • c

    cuddly-keyboard-70746

    09/20/2022, 1:34 AM
    is there a favicon in the default location? I think it is /favicon.ico. I have a tiny one there, and all the others hidden in a folder
  • c

    cuddly-keyboard-70746

    09/20/2022, 1:39 AM
    I would guess once your browsers gets that favicon then it shouldn't ask all the time
  • b

    brief-plumber-50843

    09/20/2022, 8:59 AM
    I add
    <link rel="icon" href="data:,">
    to get rid of favicon requests
  • t

    tall-river-23601

    09/20/2022, 11:44 AM
    Has anybody already given some thoughts to the concept of using using fragments to implement an automatic/declarativ lazy-loading strategy? I am thinking like a template where you have multiple tabs, every tabs content is marked as a fragment and every tab has some htmx-get on click that can load the according content fragment. Then, for the full-page rendering, there would be an option to exclude all fragments (or some of them, via a selector). On initial page-load only the current active tab content gets fetched. I am thinking about use cases where we load a really fat objects and render a really fat UI with many tabs. Am I overthinking things or would that be an appropriate use case for fragments?
1...829830831...1146Latest