From 8c018be61d87ced4c899a197c906ac734b3a35cc Mon Sep 17 00:00:00 2001 From: Ben Croker <57572400+bencroker@users.noreply.github.com> Date: Sat, 20 Feb 2021 09:15:10 +0100 Subject: [PATCH 1/2] Break out of the while loop Return will work, but is less correct and would break the flow of the function if code was ever added after it. --- src/htmx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/htmx.js b/src/htmx.js index 5c7c3c7d..ff7026f0 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -1422,7 +1422,7 @@ return (function () { while(historyCache.length > 0){ try { localStorage.setItem("htmx-history-cache", JSON.stringify(historyCache)); - return; + break; } catch (e) { triggerErrorEvent(getDocument().body, "htmx:historyCacheError", {cause:e, cache: historyCache}) historyCache.shift(); // shrink the cache and retry From 32a93388d843cbcfbb948470317e63c914704954 Mon Sep 17 00:00:00 2001 From: Matthew Molloy Date: Tue, 23 Feb 2021 18:55:00 +0700 Subject: [PATCH 2/2] settle on SSE Swap event --- src/htmx.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/htmx.js b/src/htmx.js index ff7026f0..3939b7eb 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -1169,6 +1169,7 @@ return (function () { var settleInfo = makeSettleInfo(elt); selectAndSwap(swapSpec.swapStyle, elt, target, response, settleInfo) + settleImmediately(settleInfo.tasks) triggerEvent(elt, "htmx:sseMessage", event) };