https://htmx.org logo
Join Discord
Powered by
# 🔥-django-htmx
  • h

    hundreds-camera-24900

    01/02/2022, 5:54 PM
    so that an hx-post can generate a message
  • h

    hundreds-camera-24900

    01/02/2022, 5:54 PM
    it's not perfect - there's a case where you can
  • h

    hundreds-camera-24900

    01/02/2022, 5:55 PM
    generate a message on page load, generate a message w/ hx-post, and load a boosted url
  • h

    hundreds-camera-24900

    01/02/2022, 5:55 PM
    and the boosted url can't carry over the state from the prior page
  • h

    hundreds-camera-24900

    01/02/2022, 5:55 PM
    but it's good enough I think
  • c

    cool-camera-13454

    01/02/2022, 6:00 PM
    Ah I see, that's a smart idea. I wasn't sure that would play along with the messages cookie (which as far as I know determines the new messages to render)
  • c

    cool-camera-13454

    01/02/2022, 6:00 PM
    So with your solution the messages generated after clicking on boosted links and forms will not be generated?
  • h

    hundreds-camera-24900

    01/02/2022, 6:01 PM
    they will be
  • h

    hundreds-camera-24900

    01/02/2022, 6:01 PM
    you'll just handle them like normal
  • h

    hundreds-camera-24900

    01/02/2022, 6:01 PM
    by rendering the page with the messages inserted into it
  • h

    hundreds-camera-24900

    01/02/2022, 6:02 PM
    I don't use the cookie storage, I've been using session storage since it's default
  • h

    hundreds-camera-24900

    01/02/2022, 6:02 PM
    the cookie storage is an interesting idea but then we'd have to use js to render the message right
  • h

    hundreds-camera-24900

    01/02/2022, 6:02 PM
    no it's encrypted so you still render server side
  • h

    hundreds-camera-24900

    01/02/2022, 6:02 PM
    I'm not sure if using sessionstorage vs cookie storage makes a difference
  • c

    cool-camera-13454

    01/02/2022, 6:03 PM
    Oh ok cool so they work as usual then
  • c

    cool-camera-13454

    01/02/2022, 6:05 PM
    yeah I'm not sure how those cookies work if I'm honest, haven't looked much into it. Up until now I've only been rendering messages as usual in the templates, never really had to stop and think how the system works. But of course now htmx changes that 😀
  • h

    hundreds-camera-24900

    01/02/2022, 6:06 PM
    well I think as long as you're rendering server side it doesn't change too much
  • h

    hundreds-camera-24900

    01/02/2022, 6:06 PM
    the docs say the cookies are encrypted like the session id, so I don't think there's a way to grab the data client side
  • p

    prehistoric-cat-63987

    01/03/2022, 6:30 AM
    I still don't know the use of oob-swap 🥴
  • h

    hundreds-camera-24900

    01/03/2022, 2:50 PM
    it's easy - imagine you have a login form that you're submitting with hx-post
  • h

    hundreds-camera-24900

    01/03/2022, 2:51 PM
    the form has username/password, and after submitting it you want to return a piece of html that says like "thanks for logging in today"
  • h

    hundreds-camera-24900

    01/03/2022, 2:51 PM
    that's a normal hx-post - submit a form, get an html snippet to replace it with
  • h

    hundreds-camera-24900

    01/03/2022, 2:52 PM
    but say you ALSO want to update the little "hey " in the top right corner
  • h

    hundreds-camera-24900

    01/03/2022, 2:52 PM
    that hello message isn't connected to the form - it's totally removed from the section of the dom that you just submitted
  • h

    hundreds-camera-24900

    01/03/2022, 2:53 PM
    OOB lets you piggyback the new "hey " message, outside of the new html and stick that into a totally different part of the dom
  • p

    prehistoric-cat-63987

    01/03/2022, 4:00 PM
    Oh, thanks allot. You really explain like I'm 5.
  • a

    adamant-exabyte-92636

    01/03/2022, 5:55 PM
    That is an invaluable skill - being able to explain something simply 👏👏
  • m

    mysterious-toddler-20573

    01/04/2022, 6:10 PM
    https://lp.jetbrains.com/django-developer-survey-2021-486/
  • m

    mysterious-toddler-20573

    01/04/2022, 6:11 PM
    https://twitter.com/htmx_org/status/1478427305999417345
  • m

    mysterious-toddler-20573

    01/04/2022, 6:11 PM
    !!!
1...333435...100Latest