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

Dynamically adding items to a carousel fails to update carousel #2074

Closed
withinboredom opened this issue Aug 11, 2022 · 4 comments
Closed

Dynamically adding items to a carousel fails to update carousel #2074

withinboredom opened this issue Aug 11, 2022 · 4 comments
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@withinboredom
Copy link

What package has an issue

@mantine/carousel

Describe the bug

For some reason, when the children change for the carousel, the component does not update. I've included a sandbox that adds an item to the carousel 4s after mounting. You can see the second image in the DOM, yet the carousel doesn't update.

What version of @mantine/hooks page do you have in package.json?

^5.1.1

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/trusting-ardinghelli-w05eif

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

No

Possible fix

Just a guess, there's likely some optimization to stop extraneous rerenders in the misbehaving component. Possibly forcing the component to rerender will work around the issue.

@rtivital
Copy link
Member

Thanks for reporting

@rtivital rtivital added the help wanted Contributions from community are welcome label Aug 11, 2022
@withinboredom
Copy link
Author

Can be worked around by setting a key on the Carousel with the key value being the count of the items, so if an item is added, it will remount the Carousel. It isn't ideal, but it works for my purposes.

Thanks for the awesome work, btw. I've been blown away by the polish of these components. @rtivital, do you have a patreon or part of a sponsor program to buy you a coffee/tea or something?

@rtivital rtivital added Fixed patch Completed issues that will be published with next patch (1.0.X) and removed bug help wanted Contributions from community are welcome labels Aug 11, 2022
@rtivital
Copy link
Member

Fixed in 5.1.5

@withinboredom
Copy link
Author

Thanks for the quick turn-around!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

2 participants