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

Recursively get next cards before swiping #4

Open
ajenkins opened this issue Dec 16, 2019 · 3 comments
Open

Recursively get next cards before swiping #4

ajenkins opened this issue Dec 16, 2019 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ajenkins
Copy link
Owner

If getNextCardData is slow it could slow down or block the swiping animations. To mitigate this, you could calculate the full tree of possible next cards (up to some max depth) ahead of time so the card data would be ready to go when you need it. This would basically be a depth-first-search or breadth-first-search of all possible cards based on every possible path/permutation of swipes. This could be a new prop (integer) that tells the component how many steps ahead it should compute the possible next cards.

@ajenkins ajenkins added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Dec 16, 2019
@leonzuendel
Copy link

Will this feature be implemented any time soon? I'm trying to do this because I am showing images on the cards which source is defined in the card data. And every time I swipe a card the next card flashes the image once, because it's updating the source (which of course does not change, but the "first" prop changes because the next card becomes the current card...so all the data is set again and this causes the images to flash... and that's really "ugly"...)

@leonzuendel
Copy link

For your understanding: I'm rendering the current and the next card based on an index which I increment by 1 whenever a card gets swiped away. AND my data never changes after swiping, so it's setting the same data again. I just needed to use this module rather than the one from alexbrilliant because the alexbrilliant version does not even rerender the cards when they change before swiping... Just tell me if you know any better way to implement this.

@ajenkins
Copy link
Owner Author

ajenkins commented Feb 8, 2021

Honestly, I'm not actively working on this anymore. So I wouldn't wait for this to be implemented. That being said, the code isn't too complicated so if you'd like to make a PR, I'd be happy to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants