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

Two children with the same key error when using row, lazyLoading and infinite. #1987

Open
lioryemini opened this issue Feb 12, 2021 · 3 comments

Comments

@lioryemini
Copy link

lioryemini commented Feb 12, 2021

Hi,

I'm opening this issue as a sequel to a bug that has already opened #1422 by @houkanshan.
Unfortunately, this bug has been automatically marked as stale by a bot, because it has not had recent activity.

Reference for all details at #1422

Checkout this codesandbox:
https://codesandbox.io/s/k5k9q6q07o

The setting is:

const setting = {
  slidesToShow: 1,
  slidesToScroll: 1,
  infinite: true,
  lazyLoad: true,
  row: 1,
  slidesPerRow: 4
};

The error occurs when switching between slides (see console):
image

This issue also occurred to me (latest version - 0.28.0), and breaking my carousel (duplicate "data-index" on dom) when it happens.

His solution for adding a prefix to the fallback key on "track.js" file, solve it.

Original code:
var getKey = function getKey(child, fallbackKey) {
  return child.key || fallbackKey;
};
After fix:
var getKey = function getKey(child, fallbackKey) {
  return child.key || 'fallback-' + fallbackKey;
};

Can we add it to next version fix please?
Should change the original bug status to "Open"?

Thanks!

@lioryemini lioryemini changed the title Two children with the same key warning when using row, lazyLoading and infinite. Two children with the same key error when using row, lazyLoading and infinite. Feb 12, 2021
@sozdayka
Copy link

sozdayka commented Apr 20, 2021

@lioryemini I added your changes in the PR for fix this bug

Hi, @akiran
can you check this pull request? thanks 🙏

@dm-kharkov
Copy link

Thanks @lioryemini and @sozdayka, it works for me!

@akiran Could You look on that PR please and merge that branch into the master ?
Thanks!

@VanTranTrucPhuong
Copy link

VanTranTrucPhuong commented Apr 5, 2023

@akiran, Could you help fix the issue in your source? It works well, but I must manually fix it in my source.

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

4 participants