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

    miniature-lizard-24702

    05/04/2023, 8:52 AM
    Honestly I don’t understand why people say it’s so difficult
  • r

    ripe-action-67367

    05/04/2023, 9:38 AM
    Mostly because there is a huge number of edge cases and exceptions with different calendars, time zones, light saving time, leap years, leap seconds, localizations, the fact that these things constantly change. Basic implementations are probably easy enough, but if you want something robust, you are into some deeeep rabbit hole. Tom Scott has a video about it on Computerphile
  • h

    hundreds-stone-62176

    05/04/2023, 1:05 PM
    https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca
  • f

    fancy-elephant-10660

    05/04/2023, 1:40 PM
    Hi, I have a form if the you fill in some code it should return a file but if not correct it should return validation error. Now my problem is the byte code get loaded in the html. How do I tell htmx this is a file that is returned and it should be downloaded?
  • f

    fancy-elephant-10660

    05/04/2023, 1:44 PM

    https://cdn.discordapp.com/attachments/725789747212976259/1103678625737351189/Downloads_.png▾

  • g

    great-cartoon-12331

    05/04/2023, 1:52 PM
    i have the same issue, got a suggestion but haven't tried it yet https://discord.com/channels/725789699527933952/725789747212976259/1102048255719780414
  • m

    miniature-lizard-24702

    05/04/2023, 3:47 PM
    what... there is a place that skips a friday
  • t

    tall-dinner-62086

    05/04/2023, 3:50 PM
    They skipped one friday, yes
  • b

    bitter-machine-55943

    05/04/2023, 4:28 PM
    I skipped Friday once
  • t

    tall-dinner-62086

    05/04/2023, 5:09 PM
    university parties usually happen on thursdays around here. Many fridays have been skipped.
  • i

    important-machine-88038

    05/04/2023, 9:19 PM
    I once needed to store a month-and-day in a database, but I didn't care about the year, so I used a date column and set the year to 0. A few bug reports later, I'm learning about the adoption of the Gregorian calendar in 1582.
  • d

    dazzling-shoe-67340

    05/04/2023, 9:43 PM
    hi. im running an ajax request like this when my page is loaded: document.addEventListener("DOMContentLoaded", function() { htmx.ajax('GET', '/blah'); }); (notice i don't have target or swap passed as options) my response will be a bunch of various divs that i ideally want to swap with existing divs on the page (same IDs); i thought hx-swap-oob would work somehow, but it doesnt. what's the correct (if possible) way to achieve this? (without doing multiple ajax calls?)
  • a

    ancient-shoe-86801

    05/04/2023, 9:53 PM
    check this out

    https://youtu.be/rz3D8VG_2TY▾

  • m

    mysterious-toddler-20573

    05/04/2023, 10:04 PM
    oob should work here
  • m

    mysterious-toddler-20573

    05/04/2023, 10:04 PM
    what is happening?
  • d

    dazzling-shoe-67340

    05/04/2023, 10:05 PM
    ill get back to you, still hacking at it
  • 1cg 3060 rather than replacing the on
    d

    dazzling-shoe-67340

    05/04/2023, 10:11 PM
    @mysterious-toddler-20573 rather than replacing the on-page div with the matching id div from the response, it just replaces everything in basically killing the page
    m
    • 2
    • 5
  • d

    dazzling-shoe-67340

    05/04/2023, 10:35 PM
    ok i give up
  • l

    late-king-98305

    05/04/2023, 10:49 PM
    LOL - OK, correction: "I offloaded making datepickers work to the browser folks"
  • t

    thousands-planet-99021

    05/04/2023, 11:36 PM
    Yooo what's up with JS ecosystem now, looks like a runback to PHP 4
  • t

    thousands-planet-99021

    05/04/2023, 11:37 PM
    it's depressing 😭
  • b

    bitter-machine-55943

    05/05/2023, 12:13 AM
    Are there any guidelines or rules we can follow to ensure that we don’t create endless loops when we start triggering on various events, especially when combining different tools like HTMX and Alpine and client-side $store etc?
  • b

    bitter-machine-55943

    05/05/2023, 12:39 AM
    Maybe put another way, how to avoid callback hell?
  • g

    gorgeous-ghost-95789

    05/05/2023, 3:48 AM
    I'd say that infinite loops are a different problem from "callback hell" -- at least as that was originally used to describe async Javascript. Still, I'd start with guidance like this: 0) Try not to chain events. In most circumstances, this isn't necessary. 1) Use built-in events whenever possible 2) If you must use custom events, try to limit listeners to the same widget/fragment scope whenever possible 3) If you must listen for global events (from window, or similar) or to events outside of the current widget, then let the event terminate there.. DON'T chain any additional events on to them because you won't be able to keep track of what happens next.
  • g

    gorgeous-ghost-95789

    05/05/2023, 3:52 AM
    In case you haven't seen it, htmx includes a pretty cool write-up that's closely (but not exactly) related to this: https://htmx.org/examples/update-other-content/ -- the basic idea is that there are always many ways to solve a problem, and bubbling multiple events may not always be the best way.
  • b

    bitter-machine-55943

    05/05/2023, 11:57 AM
    Thank you, good info. Maybe it’s like the
    goto
    problem. When the code can jump anywhere, it’s hard to reason about. But we use limiting concepts like loops, scopes, stacks, functions, etc to reason about the flow of execution. And when events are flying around from many components, it also seems harder to reason about. So maybe I’m looking for ways of simplifying event driven programming, such as limiting the scope of event listeners.
  • g

    gorgeous-ghost-95789

    05/05/2023, 1:51 PM
    It hasn’t been too much trouble in my experience. Just have a clear purpose and scope for the event, and don’t chain too many together at once. 😎
  • m

    mysterious-toddler-20573

    05/05/2023, 3:47 PM
    https://quii.dev/HTMX_is_the_Future
  • a

    adventurous-ocean-93733

    05/05/2023, 3:50 PM
    Came here to post this. First time I’ve upvoted an HN post from the headline alone: https://news.ycombinator.com/item?id=35829733
  • r

    refined-waiter-90422

    05/05/2023, 3:58 PM
1...111111121113...1146Latest