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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Call Carousel force update when children lenght changed #16592
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16592 +/- ##
==========================================
- Coverage 95.75% 95.71% -0.05%
==========================================
Files 258 258
Lines 7120 7123 +3
Branches 1970 2005 +35
==========================================
Hits 6818 6818
- Misses 300 303 +3
Partials 2 2
Continue to review full report at Codecov.
|
Deploy preview for ant-design ready! Built with commit 6dba711 |
excellent! |
@@ -70,6 +71,12 @@ export default class Carousel extends React.Component<CarouselProps, {}> { | |||
this.innerSlider = this.slick && this.slick.innerSlider; | |||
} | |||
|
|||
componentDidUpdate(prevProps: CarouselProps) { | |||
if (React.Children.count(this.props.children) !== React.Children.count(prevProps.children)) { | |||
this.goTo(0, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react-slick can set initialSlide
prop锛宻hould goTo(0)
be set to goTo(initialSlide)
? https://react-slick.neostack.com/docs/api#initialSlide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greate~ Could you help to send a PR about this?
related: #16748 |
馃 This is a ...
馃懟 What's the background?
fix #16583
馃挕 Solution
Call Carousel force update when children length changed
馃摑 Changelog
Fix Carousel miss active status when Children changed
鈽戯笍 Self Check before Merge