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

    mysterious-toddler-20573

    02/03/2023, 12:12 AM
    or just a lot of local state?
  • o

    orange-umbrella-16693

    02/03/2023, 1:17 AM
    Does placing htmx in body or adding
    defer
    to the script tag potentially break something?
  • r

    rich-traffic-81552

    02/03/2023, 3:10 AM
    lots of local state, it's a date picker with a start + end date, so when the start date is selected it triggers a request while the view stays open. when the request completes it swaps the input the javascript component is attached to and things break
  • m

    mysterious-toddler-20573

    02/03/2023, 3:23 AM
    mmm, yes
  • r

    rich-traffic-81552

    02/03/2023, 3:23 AM
    does hx-preserve preserve the DOM node itself or just ensure the
    outerHTML
    is the same after the request?
  • m

    mysterious-toddler-20573

    02/03/2023, 3:23 AM
    hx-preserve keeps the same node in the DOM
  • m

    mysterious-toddler-20573

    02/03/2023, 3:23 AM
    however it does detach the node
  • m

    mysterious-toddler-20573

    02/03/2023, 3:23 AM
    which can screw a lot of state up
  • m

    mysterious-toddler-20573

    02/03/2023, 3:24 AM
    I'm not sure a morph will help here, since this is mutated DOM state
  • m

    mysterious-toddler-20573

    02/03/2023, 3:24 AM
    thinking
  • r

    rich-traffic-81552

    02/03/2023, 3:25 AM
    okay thank you for the help that makes sense, I understand what's going on now so the swap oob approach seems like a reasonable work around 😄
  • r

    rich-traffic-81552

    02/03/2023, 3:26 AM
    would love any other ideas though too!
  • m

    mysterious-toddler-20573

    02/03/2023, 3:26 AM
    mmm
  • m

    mysterious-toddler-20573

    02/03/2023, 3:27 AM
    we could create a custom swap
  • m

    mysterious-toddler-20573

    02/03/2023, 3:27 AM
    and effectively do an innerHTML swap on the thing but ignore that one element
  • m

    mysterious-toddler-20573

    02/03/2023, 3:28 AM
    trying to think if that can generalize
  • m

    mysterious-toddler-20573

    02/03/2023, 3:28 AM
    the problem is you want to keep it rooted from the ground up
  • m

    mysterious-toddler-20573

    02/03/2023, 3:28 AM
    mmm
  • m

    mysterious-toddler-20573

    02/03/2023, 3:28 AM
    it's like you want a morph + an ignore
  • m

    mysterious-toddler-20573

    02/03/2023, 3:28 AM
    morph all the HTML around this thing, but don't morph this thing
  • m

    mysterious-toddler-20573

    02/03/2023, 3:28 AM
    lemme look at idiomorph and see if there is something to do that
  • m

    mysterious-toddler-20573

    02/03/2023, 3:30 AM
    https://github.com/bigskysoftware/idiomorph/blob/main/src/idiomorph.js#L120
  • m

    mysterious-toddler-20573

    02/03/2023, 3:31 AM
    we could have this return a boolean
  • m

    mysterious-toddler-20573

    02/03/2023, 3:31 AM
    and not morph if it returns false
  • m

    mysterious-toddler-20573

    02/03/2023, 3:31 AM
    this would let us annotate
    the-really-bad-thing
    and leave it alone, while still morphing all the HTML around it
  • r

    rich-traffic-81552

    02/03/2023, 3:32 AM
    yeah that's exactly what I'd want - tell the morph just literally do not do anything with the node no matter what
  • m

    mysterious-toddler-20573

    02/03/2023, 3:33 AM
    how badly do you want this
  • m

    mysterious-toddler-20573

    02/03/2023, 3:34 AM
    and are you willing to write some code
  • m

    mysterious-toddler-20573

    02/03/2023, 3:35 AM
    we would need to modify idiomorph.js and idiomorph-htmx.js
  • m

    mysterious-toddler-20573

    02/03/2023, 3:35 AM
    also, idiomorph is relatively new
1...100810091010...1146Latest