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

Carousel 在卸载组件后,持续setState(),导致页面卡死 #1397

Closed
xuqiang1227 opened this issue Apr 12, 2016 · 15 comments
Closed
Labels
🐛 Bug Ant Design Team had proved that this is a bug.

Comments

@xuqiang1227
Copy link

What you did

在项目首页使用Carousel组件实现多个图片自动轮播功能。

What actually happened

从首页跳转到其他页面时,控制台出现如下警告(多条),最终导致页面卡死:
warning.js?0260:44 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the InnerSlider component.
qq 20160412190307

Online demo

https://codepen.io/xiaoyi_1222/pen/KzoVNr

demo我打包了一份,在附件中。

Environment Information

  • The version of antd(0.12.13):
  • Your operating system and it's version(windinws 10):
  • Your browser and it's version(49.0.2623.110 m(64-bit)):
@afc163 afc163 added the 🤔 Need Reproduce We cannot reproduce your problem label Apr 12, 2016
@xuqiang1227
Copy link
Author

个人感觉是在unmount Carousel的时个,没有将定时器清除。
解决办法:在Carousel组件中添加一个componentWillUnmount()方法,该方法中将定时器清除就可以了。
其他Ant的回复。

@afc163
Copy link
Member

afc163 commented Apr 13, 2016

@xuqiang1227
Copy link
Author

@afc163 demo我单独发你邮箱(afc163@gmail.com)里。请你查收一下。

@afc163
Copy link
Member

afc163 commented Apr 13, 2016

不要发邮箱。http://codepen.io/anon/pen/pgdXYp?editors=001

@afc163
Copy link
Member

afc163 commented Apr 13, 2016

帮助我们整理出一个能重现的例子,我没有要求公开项目代码....

@xuqiang1227
Copy link
Author

@afc163 整理了个demo。

@afc163
Copy link
Member

afc163 commented Apr 13, 2016

你给的 Demo 里重现了,确认是 react-slick 的问题,在上面的 issue 我给 react-slick 提了这个问题,等待 react-slick 修复。

PS:我把你的 Demo 链接移除了。

@afc163 afc163 added 🐛 Bug Ant Design Team had proved that this is a bug. and removed 🤔 Need Reproduce We cannot reproduce your problem labels Apr 13, 2016
@afc163
Copy link
Member

afc163 commented Apr 13, 2016

已提 pr 。

@jljsj33
Copy link
Member

jljsj33 commented Apr 20, 2016

官网案例里的 autoplay 切换回来还是卡死。。。

@xuqiang1227
Copy link
Author

@afc163 什么时候能修复呢?项目等着升级呢。。。。

@afc163
Copy link
Member

afc163 commented Apr 27, 2016

react-slick 的问题,我们也没有办法,可以去上面的 PR 中帮助我们催促官方合并。

@jljsj33
Copy link
Member

jljsj33 commented Apr 28, 2016

如果是 banner,可以试试,banner-anim demo,,,,我已经对那 react-slick 彻底无语了。。。

@xuqiang1227
Copy link
Author

其实我们是不想再引入更多的第三方组件了,再等一个迭代。

@afc163 afc163 mentioned this issue May 4, 2016
15 tasks
@afc163
Copy link
Member

afc163 commented May 6, 2016

react-slick 已发布 0.12.1 。

@afc163 afc163 closed this as completed May 6, 2016
@yangmingfa
Copy link

这个问题还是存在,会一直报这个警告

devs-cloud pushed a commit to devs-cloud/react-slick that referenced this issue Dec 29, 2019
opensource521 pushed a commit to opensource521/react-slick-com that referenced this issue Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants