Skip to content
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

Race condition: app delays with loading (the same) icon #151

Closed
roymap opened this issue Apr 5, 2024 · 1 comment
Closed

Race condition: app delays with loading (the same) icon #151

roymap opened this issue Apr 5, 2024 · 1 comment

Comments

@roymap
Copy link

roymap commented Apr 5, 2024

There is a race-condition that we finally found that was causing our app to "wait" for about 10 seconds.

if (!state.value?.[iconKey.value]) {
    isFetching.value = true
    state.value[iconKey.value] = await loadIcon(resolvedIcon.value).catch(() => undefined)
    isFetching.value = false
  }

If your page has 1000s of the same icon, the loadIcon gets called 1000s of times before the if statement is true. The loadIcon method is slower than nuxt-icon calling this with each icon on the page.

You need to set either another variable that designates that you are already loading this icon, or set state.value[iconKey.value] with a temporary non-falsy value.

@antfu
Copy link
Member

antfu commented Jul 18, 2024

We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info.
Please provide a minimal reproduction to reopen the issue.
Thanks.

Why reproduction is required

@antfu antfu closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants