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

Page freeze with 100% CPU load when (at least 2 of) slides doesn't have id prop #18

Closed
tehnolog opened this issue Apr 5, 2021 · 2 comments

Comments

@tehnolog
Copy link

tehnolog commented Apr 5, 2021

I think there's 2 options:

  1. Make id prop not mandatory. Maybe create default internal id's based on array index (slides is an Array anyway).
  2. Handle this case and just throw an error with notice. Add note about this in docs.
@axmad386
Copy link
Contributor

I just read the Slidy Component, I think this is because Slidy loop slides with hardcoded item.id as key. May be we can add something like keyExtractor as function to extract which key to become id and add fallback to index when there is no id key or keyExtractor not set.

{#each slides as item, i (item.id)}

may be we can change to this

<script>
export let keyExtractor = (item)=>item.id
</script>
{#each slides as item, i (keyExtractor(item)||i)}

I can make PR if necessary

@Valexr
Copy link
Owner

Valexr commented Jun 1, 2021

merged tx

@Valexr Valexr closed this as completed Jun 1, 2021
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

3 participants