Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
DX: Split out feature flags from the Me user data endpoint #7734
DX: Split out feature flags from the Me user data endpoint #7734
Changes from 2 commits
4138169
d15a213
bbdb775
ac07b18
50497ba
a1c8002
6f3232e
cf7c920
ca10d9d
cb0efeb
28d8a57
4d7ce7c
8df4923
f37b441
5c08bbf
075ae2c
d03a9cd
353ad78
692ccae
cfa8038
f725676
6334c27
029b063
d60d1e5
e30fa32
c665d5e
3805446
c43f52f
a97c0d2
21b72f6
912f6db
c0984ff
41eb983
122ac10
7e68a8c
8a9e055
4514895
4ac6617
cf173f2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Instead of recording lastFetchedTime, IIRC the more common approach to TTL is to set the expiry timestamp
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.
Also, you might be able to use @fregante's library here: https://github.com/fregante/webext-storage-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.
We used a "last fetched time" approach recently in the
useTheme
caching, so was just sticking to the same pattern here. At some point we should generalize/abstract this sort of api caching logic out, regardless.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.
Oh interesting, this definitely looks useful for abstracting out the caching logic like I mentioned! I'll keep this in mind for next steps, but I think it's out of scope right now in this PR.
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.
I decided to give it a shot and use
webext-storage-cache
for this, but I'm running into an error in jest tests:I pushed the commit so changes are here, @fregante (or anyone) any idea what's going on with this Jest error?
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.
Both webext-storage-cache and that
@sindresorhus/to-milliseconds
need to be added to Jest's exclusion list. It's the usual issue with ESM in Jest 🥲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.
That's this list here:
pixiebrix-extension/jest.config.js
Line 33 in f747029
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.
And yet they seem to have no desire to solve it. It's infuriating.
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.
I think they did add ESM support but it's a pain to set up: https://jestjs.io/docs/ecmascript-modules
Mocking is still a wip in jestjs/jest#10025