https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • however in this response
    c

    cool-match-83608

    04/05/2023, 9:12 AM
    however in this response
  • i want to trigger a refresh on my table
    c

    cool-match-83608

    04/05/2023, 9:12 AM
    i want to trigger a refresh on my table
  • because as soon as this file will be downloaded, an entry will be created in the log DB
    c

    cool-match-83608

    04/05/2023, 9:13 AM
    because as soon as this file will be downloaded, an entry will be created in the log DB
  • and i want the table to display the latest add
    c

    cool-match-83608

    04/05/2023, 9:13 AM
    and i want the table to display the latest add
  • c

    cool-match-83608

    04/05/2023, 9:15 AM

    https://cdn.discordapp.com/attachments/725789747212976259/1093101558511702086/image.png▾

  • i was technically able to do this
    c

    cool-match-83608

    04/05/2023, 9:24 AM
    i was technically able to do this
  • response.addHeader("HX-Trigger", "newOther")
    c

    cool-match-83608

    04/05/2023, 9:24 AM
    response.addHeader("HX-Trigger", "newOther")
  • but its not triggering my event :/
    c

    cool-match-83608

    04/05/2023, 9:24 AM
    but its not triggering my event :/
  • i managed to get the event working
    c

    cool-match-83608

    04/05/2023, 10:04 AM
    i managed to get the event working
  • and managed to get my back end send me the updated list, at the moment just struggling to get it displayed
    c

    cool-match-83608

    04/05/2023, 10:05 AM
    and managed to get my back end send me the updated list, at the moment just struggling to get it displayed
  • I was able to get it worked
    c

    cool-match-83608

    04/05/2023, 11:14 AM
    I was able to get it worked
  • Thanks though everybody
    c

    cool-match-83608

    04/05/2023, 11:15 AM
    Thanks though everybody
  • hello guys, I'm added a `console.log(window.location.pathname)` but it keeps returning the old pathname after a load with hx-boost
    t

    thankful-computer-7658

    04/05/2023, 1:33 PM
    hello guys, I'm added a
    console.log(window.location.pathname)
    but it keeps returning the old pathname after a load with hx-boost
  • the first load is ok, the next ones return the old value
    t

    thankful-computer-7658

    04/05/2023, 1:33 PM
    the first load is ok, the next ones return the old value
  • t

    thankful-computer-7658

    04/05/2023, 1:36 PM
    https://cdn.discordapp.com/attachments/725789747212976259/1093167201533579304/Screen_Recording_2023-04-05_at_09.33.46.mp4
  • can you paste in your code?
    m

    mysterious-toddler-20573

    04/05/2023, 1:37 PM
    can you paste in your code?
  • its just a ```html <script> console.log(window.location.pathname) </script> ``` in the code
    t

    thankful-computer-7658

    04/05/2023, 1:38 PM
    its just a
    Copy code
    html
    
    <script>
      console.log(window.location.pathname)
    </script>
    in the code
  • and I'm using hx-boost="true" in the links
    t

    thankful-computer-7658

    04/05/2023, 1:38 PM
    and I'm using hx-boost="true" in the links
  • mmm
    m

    mysterious-toddler-20573

    04/05/2023, 1:38 PM
    mmm
  • navigating around on the htmx.org website and running window.location.pathname in the console gives the expected results
    m

    mysterious-toddler-20573

    04/05/2023, 1:39 PM
    navigating around on the htmx.org website and running window.location.pathname in the console gives the expected results
  • 🤔
    m

    mysterious-toddler-20573

    04/05/2023, 1:39 PM
    🤔
  • htmx might be executing the script before the pushstate maybe?
    g

    gorgeous-airport-54386

    04/05/2023, 1:39 PM
    htmx might be executing the script before the pushstate maybe?
  • in that case I would expect it to be one path behind, is that what you are seeing <@286693716553629699> ?
    m

    mysterious-toddler-20573

    04/05/2023, 1:40 PM
    in that case I would expect it to be one path behind, is that what you are seeing @thankful-computer-7658 ?
  • yeah, looks like from the behavior its executing before the page change
    t

    thankful-computer-7658

    04/05/2023, 1:41 PM
    yeah, looks like from the behavior its executing before the page change
  • is there a way I could be sure?
    t

    thankful-computer-7658

    04/05/2023, 1:41 PM
    is there a way I could be sure?
  • ```js htmx.logAll() ```
    m

    mysterious-toddler-20573

    04/05/2023, 1:48 PM
    Copy code
    js
      htmx.logAll()
  • that will log all events
    m

    mysterious-toddler-20573

    04/05/2023, 1:48 PM
    that will log all events
  • yeah I navigated to "users", it logged `/dashboard` only and then the events were logged
    t

    thankful-computer-7658

    04/05/2023, 1:50 PM
    yeah I navigated to "users", it logged
    /dashboard
    only and then the events were logged

    https://cdn.discordapp.com/attachments/725789747212976259/1093170894517567568/Screen_Shot_2023-04-05_at_09.50.07.jpg▾

  • got it working
    t

    thankful-computer-7658

    04/05/2023, 2:05 PM
    got it working
  • I used `document.addEventListener('htmx:pushedIntoHistory',`
    t

    thankful-computer-7658

    04/05/2023, 2:05 PM
    I used
    document.addEventListener('htmx:pushedIntoHistory',
1...108510861087...1146Latest