- Notifications
You must be signed in to change notification settings - Fork584
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(cache): return cached account as promise#2623
Conversation
|
✅ Deploy Preview forelk-docs canceled.
|
✅ Deploy Preview forelk-zone ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
const promise = useMastoClient().v1.statuses.$select(id).fetch() | ||
.then((status) => { | ||
cacheStatus(status) |
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.
This is a bit confusing. Is it really needed for thekey
to be recalculated? Couldn't we directly callcache.set(key, status)
here?
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 register 2 things there... the code is the original, we can chabge it but the code will be duplicated
if (r.acct && !r.acct.includes('@') && domain) | ||
r.acct = `${r.acct}@${domain}` | ||
cacheAccount(r, server, true) |
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.
Same here, but this one seems to be doing more. It may be good to callcache.set(key, r)
here and then do whatever elsecacheAccount
does in a separate function. We could do that in another PR though.
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.
This pr is about to fix the return on these 3 methods, should return a promise to avoid errors like.then not found
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 can send a pr tmr to include your suggestions
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.
Ah, it seems I was looking at a previous commit
const promise = lookupAccount() | ||
.then((r) => { | ||
cacheAccount(r, server, true) |
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.
Same here. I think it is important that we make sure thekey
is the same, so we don't leave any promises in the cache.
No description provided.