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.
This commit is contained in:
Ben Croker 2021-02-20 09:15:10 +01:00 committed by GitHub
parent 45daaa90c9
commit 8c018be61d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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