Support #anchor redirect refresh (#1172)

This commit is contained in:
Fran Peručić 2023-09-14 18:59:48 +02:00 committed by GitHub
parent 3845e0f92e
commit 7296c0d943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3307,16 +3307,17 @@ return (function () {
return; return;
} }
var shouldRefresh = hasHeader(xhr, /HX-Refresh:/i) && "true" === xhr.getResponseHeader("HX-Refresh");
if (hasHeader(xhr, /HX-Redirect:/i)) { if (hasHeader(xhr, /HX-Redirect:/i)) {
location.href = xhr.getResponseHeader("HX-Redirect"); location.href = xhr.getResponseHeader("HX-Redirect");
shouldRefresh && location.reload();
return; return;
} }
if (hasHeader(xhr,/HX-Refresh:/i)) { if (shouldRefresh) {
if ("true" === xhr.getResponseHeader("HX-Refresh")) { location.reload();
location.reload(); return;
return;
}
} }
if (hasHeader(xhr,/HX-Retarget:/i)) { if (hasHeader(xhr,/HX-Retarget:/i)) {