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鈥檒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

Merged
merged 1 commit into from May 14, 2019

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented May 14, 2019

馃 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

馃懟 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

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@codecov
Copy link

codecov bot commented May 14, 2019

Codecov Report

Merging #16592 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage 螖
components/carousel/index.tsx 96.55% <100%> (+0.18%) 猬嗭笍
components/_util/wave.tsx 85.84% <0%> (-2.84%) 猬囷笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update d576c4b...6dba711. Read the comment docs.

@netlify
Copy link

netlify bot commented May 14, 2019

Deploy preview for ant-design ready!

Built with commit 6dba711

https://deploy-preview-16592--ant-design.netlify.com

@zombieJ zombieJ merged commit 5621b7b into master May 14, 2019
@delete-merged-branch delete-merged-branch bot deleted the carousel-fix branch May 14, 2019 16:39
@rdmclin2
Copy link
Member

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);
Copy link
Member

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

Copy link
Member Author

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?

@yoyo837
Copy link
Contributor

yoyo837 commented May 23, 2019

related: #16748

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

Successfully merging this pull request may close these issues.

Carousel lost slick dot active status after request
3 participants