Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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

Merged

Conversation

userquin
Copy link
Member

@userquinuserquin commentedFeb 25, 2024
edited
Loading

No description provided.

@stackblitzStackBlitz
Copy link

Review PR in StackBlitz CodeflowRun & review this pull request inStackBlitz Codeflow.

@netlifyNetlify
Copy link

netlifybot commentedFeb 25, 2024
edited
Loading

Deploy Preview forelk-docs canceled.

NameLink
🔨 Latest commit3e2bbdf
🔍 Latest deploy loghttps://app.netlify.com/sites/elk-docs/deploys/65db81aadf98800007d268e1

@netlifyNetlify
Copy link

netlifybot commentedFeb 25, 2024
edited
Loading

Deploy Preview forelk-zone ready!

NameLink
🔨 Latest commit3e2bbdf
🔍 Latest deploy loghttps://app.netlify.com/sites/elk-zone/deploys/65db81aa45dbb100088e5800
😎 Deploy Previewhttps://deploy-preview-2623--elk-zone.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site configuration.

@userquinuserquin changed the titleperf(ui): cache account fetch promises until resolved and store promise in cacheperf(ui): cache account fetch promises until resolvedFeb 25, 2024
@userquinuserquin marked this pull request as draftFebruary 25, 2024 16:36
@userquinuserquin marked this pull request as ready for reviewFebruary 25, 2024 16:55
@userquinuserquin marked this pull request as draftFebruary 25, 2024 18:00
@userquinuserquin marked this pull request as ready for reviewFebruary 25, 2024 18:06
@userquinuserquin changed the titleperf(ui): cache account fetch promises until resolvedfix(ui): return cached account as promiseFeb 25, 2024
@userquinuserquin changed the titlefix(ui): return cached account as promisefix(cache): return cached account as promiseFeb 25, 2024

const promise = useMastoClient().v1.statuses.$select(id).fetch()
.then((status) => {
cacheStatus(status)
Copy link
Member

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?

Copy link
MemberAuthor

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)
Copy link
Member

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.

Copy link
MemberAuthor

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

Copy link
MemberAuthor

@userquinuserquinFeb 25, 2024
edited
Loading

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

Copy link
Member

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)
Copy link
Member

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.

@patak-devpatak-dev added this pull request to themerge queueFeb 25, 2024
Merged via the queue intomain with commit748dd5eFeb 25, 2024
17 checks passed
@patak-devpatak-dev deleted the userquin/perf-avoid-multiple-account-fetching branchFebruary 25, 2024 19:45
shuuji3 pushed a commit to shuuji3/elk that referenced this pull requestFeb 29, 2024
shuuji3 pushed a commit to shuuji3/elk that referenced this pull requestFeb 29, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@patak-devpatak-devpatak-dev approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@userquin@patak-dev

[8]ページ先頭

©2009-2025 Movatter.jp