Skip to content
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

Bug: When using LocalStorage for cache, clear() does not work #76

Closed
omgitsnes opened this issue Aug 31, 2022 · 1 comment
Closed

Bug: When using LocalStorage for cache, clear() does not work #76

omgitsnes opened this issue Aug 31, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@omgitsnes
Copy link

omgitsnes commented Aug 31, 2022

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

I'm using useHttpCacheLocalStorage to cache with LocalStorage and the request results are being cached with key '@cache-example'.
The culprit seems to theese 2 lines, where i think createKey() there shoud not be there:
image

When I try to clear all cached entries with HttpCacheManager clear(), it iterates all the keys and ads a new '@cache' prefix making the previous key @cahe-@cache-example:

image

Expected behavior

Localstorage entries related to cached data should have been deleted.

Minimal reproduction of the problem with instructions

It is possible to reproduce using the playground app with useHttpCacheLocalStorage.

Environment


Angular version: 14.0.1
Cashew version: 3.0.0


Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

@NetanelBasal
Copy link
Member

You're welcome to submit a PR with the fix :)

@NetanelBasal NetanelBasal added bug Something isn't working good first issue Good for newcomers labels Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants