Skip to content
Snippets Groups Projects
Commit 20f7845b authored by Paolo Brasolin's avatar Paolo Brasolin
Browse files

fix: switch gradually from sessionstorage to localstorage

parent f2925dce
No related branches found
Tags v1.10.2
No related merge requests found
Pipeline #28085 passed
......@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Implement fallback storage for users disabling cookies.
- Switch (gradually) from `sessionStorage` to `localStorage`.
## [1.10.1] - 2022-09-27
......
......@@ -4,6 +4,7 @@ export default class Storage {
constructor() {
try {
window.localStorage;
window.sessionStorage;
} catch {
this.fallingBack = true;
......@@ -17,7 +18,7 @@ export default class Storage {
if (this.fallingBack) {
this.fallback[key] = value;
} else {
sessionStorage.setItem(key, value);
localStorage.setItem(key, value);
}
}
......@@ -27,7 +28,8 @@ export default class Storage {
? this.fallback[key]
: null;
} else {
return sessionStorage.getItem(key);
// NOTE: sessionStorage is there because we started using that, silly me and silly Chrome. It can be removed safely in future.
return localStorage.getItem(key) || sessionStorage.getItem(key);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment