Merge pull request #6 from bigskysoftware/refresh-support2

Refresh support2
This commit is contained in:
1cg 2025-10-28 08:01:59 -05:00 committed by GitHub
commit 751da3b01a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,6 +94,7 @@ var htmx = (() => {
viewTransitions: true,
historyEnabled: true,
selfRequestsOnly: true,
reloadOnHistoryNavigation: false,
defaultSwapStyle: "innerHTML",
defaultTimeout: 60000 /* 00 second default timeout */
}
@ -762,7 +763,7 @@ var htmx = (() => {
}
process(elt) {
if (this.__ignore(elt)) return
if (this.__ignore(elt)) return;
if (elt.matches(this.__actionSelector)) {
this.__initializeElement(elt)
}
@ -1350,7 +1351,15 @@ var htmx = (() => {
__restoreHistory(path) {
path = path || location.pathname + location.search;
if (this.__trigger(document.body, "htmx:before:restore:history", {path, cacheMiss: true})) {
location.reload();
if (htmx.config.reloadOnHistoryNavigation) {
location.reload();
} else {
this.ajax('GET', path, {
target: 'body',
swap: 'outerHTML',
request: {headers: {'HX-History-Restore-Request': 'true'}}
});
}
}
}