Commit Graph

8 Commits

Author SHA1 Message Date
Joffrey JAFFEUX be75773375
FIX: fully rely on keyValueStore to prevent error (#12)
* FIX: fully rely on keyValueStore to prevent error

The component was generating errors for some users due to direct access to `localStorage`:

```
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Object.expireOldValues (https://d3bpeqsaub0i6y.cloudfront.net/theme-javascripts/33bf35dc19b970a42f8c1e7d57d8cc72d6205bbd.js?__ws=meta.discourse.org:157:14)
    at Object.initialize (https://d3bpeqsaub0i6y.cloudfront.net/theme-javascripts/33bf35dc19b970a42f8c1e7d57d8cc72d6205bbd.js?__ws=meta.discourse.org:193:12)
    at o.initialize (https://d11a6trkgmumsb.cloudfront.net/assets/discourse-2bd9a9aa6b5c9cbee990a03159f5bff41fe503fe74814c3b66b3770876913dd5.gz.js:68:38)
```

This commits removes old unnecessary code using cookies and uses latest API from core `removeKeys`. Old discourse instances will just not evict old keys which is a minor annoyance.

* linting
2022-08-22 00:25:50 +02:00
Jarek Radosz faf88c2209
DEV: Fix `key-value-store:main` deprecation (#11) 2022-08-13 22:40:11 +02:00
Jarek Radosz ba7ca9e588
DEV: Fix typo (#10) 2022-08-13 22:39:58 +02:00
Jarek Radosz 1c4f5b1a99
DEV: Add CI setup and fix linting issues (#9) 2022-06-18 21:27:31 +02:00
David Taylor 9a002eed80
FIX: Dropdowns following recent refactoring (#7) 2022-01-13 16:48:07 -08:00
David Taylor 9882e993c5 DEV: Remove JQuery 2022-01-13 13:02:06 +00:00
David Taylor 468cf81fd2 DEV: Migrate to local storage
Setting cookies means that they're sent in the request headers for every HTTP request. This will have a (tiny) impact on performance, plus it can raise privacy concerns. Using localStorage is more appropriate for this use case.

This commit includes migration logic for any previously-saved values.

Previously the cookies were set to last for the 'session'. localStorage doesn't have an expiration mechanism, so this commit implements a 7-day expiration on the values.
2022-01-13 13:02:06 +00:00
David Taylor 6c43321b28 DEV: Apply prettier, remove es6 extension 2022-01-13 13:02:06 +00:00