New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear cache when historyCacheSize is set to 0 #1222
Conversation
Hey, if you're still interested in merging those changes, could you please retarget your PR to the |
ab39b8d
to
70523ad
Compare
@Telroshan Here you go. |
src/htmx.js
Outdated
@@ -2193,6 +2193,7 @@ return (function () { | |||
historyCache.shift(); // shrink the cache and retry | |||
} | |||
} | |||
if (historyCache.length === 0) localStorage.removeItem("htmx-history-cache"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here?
Also maybe this should be up near the top and avoid all the logic in this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aomader can you check in on this? Would like to merge this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@1cg I added a comment and moved it to the top to exit early. Note however that this changes the current behavior w.r.t. the htmx:historyItemCreated
that was triggered up until now. However, I'd argue that the new behavior is more correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
70523ad
to
6c20464
Compare
Fixes #1221