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

    mysterious-toddler-20573

    09/11/2022, 6:20 PM
    at least in theory
  • w

    wonderful-shampoo-13605

    09/11/2022, 7:21 PM
    Can I see an example? I can't tell from the docs how I'd do it
  • b

    bland-coat-6833

    09/11/2022, 7:24 PM
    Copy code
    html
    
    <tbody id="mailbox" hx-sse="swap:new_mail" hx-swap="afterbegin">
    So that’s what I do on the target element.
  • b

    bland-coat-6833

    09/11/2022, 7:26 PM
    I connect the SSE with
    Copy code
    html
    
    <table class="dt mt4" hx-sse="connect:/newmail/{{ mailbox }}/">
  • b

    bland-coat-6833

    09/11/2022, 7:26 PM
    (Replace with your url)
  • w

    wonderful-shampoo-13605

    09/11/2022, 7:26 PM
    Ah - awesome. Thanks for the help! Still new to this so examples are super useful
  • b

    bland-coat-6833

    09/11/2022, 7:27 PM
    I have a memory of the SSE docs maybe not being exactly up to date. Though that was months ago.
  • w

    wonderful-shampoo-13605

    09/11/2022, 7:32 PM
    I think it's more just the concepts - it makes sense now that the
    sse
    response is a "thing" that I can control with hx-swap, I just didn't think about it that way
  • b

    bland-coat-6833

    09/11/2022, 7:32 PM
    Hmm. Seems okay… (sorry for the delay). Might be worth turning debugging on and seeing if you get any more clues. (Or summon @mysterious-toddler-20573 to have a peek)
  • a

    ancient-shoe-86801

    09/11/2022, 8:10 PM
    I implemented and run a local test, and they seem to not be
  • a

    ancient-shoe-86801

    09/11/2022, 8:14 PM
    a load from a standard link (so no
    HX-Request
    header) that triggers a 304 loaded the partial version of the HTML, cached from a previous request with
    HX-Request: true
  • a

    ancient-shoe-86801

    09/11/2022, 8:23 PM
    it accounts for query strings, though
  • a

    ancient-shoe-86801

    09/11/2022, 8:39 PM
    double checked it for both Etags and last-modified
  • m

    mysterious-toddler-20573

    09/11/2022, 8:47 PM
    🤔
  • m

    mysterious-toddler-20573

    09/11/2022, 8:47 PM
    maybe we should always include a parameter in htmx requests?
  • m

    mysterious-toddler-20573

    09/11/2022, 8:47 PM
    and not push it
  • a

    ancient-shoe-86801

    09/11/2022, 8:47 PM
    that's the workaround I was thinking of
  • m

    mysterious-toddler-20573

    09/11/2022, 8:47 PM
    ?htmx-cache-buster=true
  • a

    ancient-shoe-86801

    09/11/2022, 8:51 PM
    oh, wait, I'm finding something on the docs
  • a

    ancient-shoe-86801

    09/11/2022, 8:51 PM
    let me test
  • a

    ancient-shoe-86801

    09/11/2022, 8:57 PM
    I added
    Vary: HX-Request
    to my test, but it keeps caching the wrong response 🤔
  • a

    ancient-shoe-86801

    09/11/2022, 8:58 PM
    unless I am understanding this wrong, that should work
  • a

    ancient-shoe-86801

    09/11/2022, 8:58 PM
    link to docs if anybody is curious: https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#vary
  • m

    mysterious-toddler-20573

    09/11/2022, 9:00 PM
    awesome find, we should definitely implement this
  • g

    gorgeous-airport-54386

    09/11/2022, 9:00 PM
    it's a response header
  • a

    ancient-shoe-86801

    09/11/2022, 9:04 PM
    correct
  • a

    ancient-shoe-86801

    09/11/2022, 9:05 PM
    so it's up to the server, as part of generating the etag or last-modified response headers, to set the right Vary
  • a

    ancient-shoe-86801

    09/11/2022, 9:06 PM
    good news, it's seems that the issue is not the issue as the standard accounts for it. Bad news, I can't get it to work?
  • a

    ancient-shoe-86801

    09/11/2022, 9:13 PM
    ok, Vary works for last-modified, but not for etag... will keep researching
  • a

    ancient-shoe-86801

    09/11/2022, 9:18 PM
    Ok, I think I get why this is happening with Etag. The ETag is supposed to be a hash calculated from the response. So, formally, the Etag for the full HTML and the Etag for the partial should be different. The server shouldn't be generating the same Etag for both responses.
1...823824825...1146Latest