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

重复渲染问题 #599

Closed
defolly opened this issue Sep 17, 2017 · 6 comments
Closed

重复渲染问题 #599

defolly opened this issue Sep 17, 2017 · 6 comments

Comments

@defolly
Copy link

defolly commented Sep 17, 2017

打断点试了一下,每次打开菜单,都会多次重复渲染。其实第一次渲染页面就出来了
image

@chimisu
Copy link

chimisu commented Sep 22, 2017

我也遇到了

@fkpwolf
Copy link

fkpwolf commented Oct 17, 2017

dvajs/dva-example-user-dashboard#25 一样的问题。

@gzcz
Copy link

gzcz commented Nov 2, 2017

1、左侧菜单是树形目录,需要递归遍历,老是重复渲染,在i3低配置的笔记本上,根本就是卡死
2、根路由同级除了/ 还会有 /login什么的,然后左侧菜单点击时,右侧的路由视图更新,而不是App.jsx重复渲染,卡卡的

@superlbr
Copy link
Collaborator

菜单这种不经常变动的,可以缓存,或者间接生成。这一点,我觉得ant-design-pro 好些,但是界面没有这个好看,吐槽。

@quanpower
Copy link
Contributor

同样碰到一个页面渲染若干次,尤其是用了setInterval定时刷新的页面更不得了了,直接干爆

@superlbr
Copy link
Collaborator

superlbr commented Mar 9, 2018

  1. 渲染是浏览器的行为
  2. 一个页面加载完了,是不是就不渲染了呢?错,浏览器一直在渲染
  3. 为什么感觉到了多次渲染/闪屏?因为数据更新了,react.render重新返回了jsx元素
  4. 所以有loading、预加载块样式、React 同构直出(SSR)

related #667

@superlbr superlbr closed this as completed Mar 9, 2018
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

No branches or pull requests

6 participants