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

    tall-dinner-62086

    12/10/2022, 8:40 PM
    I guess it depends on how much you actually need a frame. htmx lets you load arbitrary html into any element, so the need for frames is largely removed. If for some reason you actually need to keep the original frame behavior, you would need a bit of javascript or hyperscript to change the src attribute.
  • t

    thankful-ice-8687

    12/11/2022, 2:22 AM
    Can htmx handle complex client state management?
  • m

    mysterious-toddler-20573

    12/11/2022, 2:23 AM
    in htmx, hypermedia is the engine of application state
  • m

    mysterious-toddler-20573

    12/11/2022, 2:23 AM
    if you want a super complicated client-side model, you probably don't want htmx
  • t

    thankful-ice-8687

    12/11/2022, 2:23 AM
    Any way to mix the two?
  • m

    mysterious-toddler-20573

    12/11/2022, 2:24 AM
    with the caveat that, if that model is self-contained within an island and communicates with the rest of the application via events, then it can probably integrate cleanly w/ htmx
  • m

    mysterious-toddler-20573

    12/11/2022, 2:24 AM
    https://htmx.org/essays/hypermedia-friendly-scripting/
  • t

    thankful-ice-8687

    12/11/2022, 2:24 AM
    Ty, will read 🙂
  • m

    mysterious-toddler-20573

    12/11/2022, 2:25 AM
    👍
  • m

    mysterious-toddler-20573

    12/11/2022, 2:25 AM
    generally I would recommend pragmatism and, if your entire app has a lot of client-side state, don't try to hard to force htmx on top of it
  • t

    thankful-ice-8687

    12/11/2022, 2:29 AM
    Yeah I come from a pure CSR web app background and fell into the rabbit hole a month ago lol
  • l

    late-king-98305

    12/11/2022, 3:13 AM
    Regarding the whole URL thing - when I'm building things, I try my best to make a refresh (F5) return to the spot where the user actually is. I won't sit here and say you couldn't find instances in any of my GitHub repos where that isn't the case, but I've found that sticking that idea in the back of my mind helps me structure URLs. Interestingly, most SPAs I've worked with have also handled this correctly, assuming that the page was defined as a route.
  • l

    late-king-98305

    12/11/2022, 3:15 AM
    I will admit, though, "what if a user comes straight here?" seems to not be a concept new web devs are taught; this knowledge has been gained through that time-honored technique of "doing it wrong until I learned better."
  • r

    refined-waiter-90422

    12/11/2022, 6:33 AM
    htmx boost and hotwire are pretty far ahead of the curve here, but once browsers support the transition API in the mainstream, i think it's GG for the typical SPA framework usecase.
  • r

    refined-waiter-90422

    12/11/2022, 6:35 AM
    The last 10 years have pretty much been all about removing the page refresh lol.
  • b

    bitter-carpet-58319

    12/11/2022, 9:27 AM
    Old CGI site is relatively large and there is no need to rewrite it from scratch. Only need is to rewrite content of few frames its actual design disallow control them on mobile devices. As no one here know javascript (we are not an IT company), looking for way to do this with HMTX. Still thinking about to transfer item selected by to parameter of tag (if we can stay with tag usage, interframe communication is possible) but have no idea how to do such --> transfer. If there is a simple additional JS code allow such behaviour, we can employ it, but have no idea wuth JS.
  • f

    freezing-controller-74032

    12/11/2022, 10:00 AM
    Guys how to rename the submit text after the request is clicked and before the response is received ?
  • h

    high-article-21845

    12/11/2022, 11:17 AM
    hi, i was wondering if this is the right forum to ask after googling for couple of days and reading htmx code out in the wild. so i would like to get rid off the javascript as much as possible in a project. the first candidate to de-javscriptify is the login flow. i need to call into an api endpoint /who-am-i and if it returns 403 redirect the user the /login screen and if the api returns 200 display the username. is there a way in htmx to somehow handle the response from /who-am-i and branch on the result?
  • h

    high-article-21845

    12/11/2022, 11:17 AM
    (if this is not the right forum, or if i am asking something that is documented somewhere please redirect me)
  • m

    miniature-lizard-24702

    12/11/2022, 11:29 AM
    /who-am-i returns json or html?
  • m

    miniature-lizard-24702

    12/11/2022, 11:36 AM
    wouldn't you do this at a page level? if you go to
    /locked_page
    and you aren't logged in, the server should direct you to the login page?
  • h

    high-article-21845

    12/11/2022, 11:50 AM
    it can return both. i am prepping out infra for SSR so it has a /who-am-i.json and a /who-am-i.html endpoint
  • h

    high-article-21845

    12/11/2022, 11:51 AM
    absolutely
  • h

    high-article-21845

    12/11/2022, 11:51 AM
    so how i check if the user is logged in on /locked-page
  • m

    miniature-lizard-24702

    12/11/2022, 11:51 AM
    so you could just return html when you are logged in and if not send back a redirect response?
  • m

    miniature-lizard-24702

    12/11/2022, 11:51 AM
    in the who-am-i?
  • h

    high-article-21845

    12/11/2022, 11:52 AM
    you mean move the entire system to backend and leave out the CDN html (aka the SPA frontend we previously had)?
  • h

    high-article-21845

    12/11/2022, 11:53 AM
    the reason we would like to have some html on the CDN is that people could load the public part of the page from the CDN and just fill in the parts that are dynamic
  • m

    miniature-lizard-24702

    12/11/2022, 11:53 AM
    aren't you sending your token to who-am-i to get username?
  • h

    high-article-21845

    12/11/2022, 11:53 AM
    if it makes sense
1...941942943...1146Latest