mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-29 05:51:39 +00:00
Properly set title during history cache miss (#1014)
I am running HTMX with hx-boost and the history cache disabled (it's important to not show stale content to my users unless my backend uses cache-control headers to do so, in which case I simply rely on the fetch being cached). However, during 'history cache misses', the page title is not properly set. This fixes it (mirroring the logic in `handleAjaxResponse`).
This commit is contained in:
parent
d94f38d65c
commit
3c6b5996a1
@ -1972,6 +1972,15 @@ return (function () {
|
||||
fragment = fragment.querySelector('[hx-history-elt],[data-hx-history-elt]') || fragment;
|
||||
var historyElement = getHistoryElement();
|
||||
var settleInfo = makeSettleInfo(historyElement);
|
||||
var title = findTitle(this.response);
|
||||
if (title) {
|
||||
var titleElt = find("title");
|
||||
if (titleElt) {
|
||||
titleElt.innerHTML = title;
|
||||
} else {
|
||||
window.document.title = title;
|
||||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
swapInnerHTML(historyElement, fragment, settleInfo)
|
||||
settleImmediately(settleInfo.tasks);
|
||||
|
Loading…
x
Reference in New Issue
Block a user