How can the delay before displaying meteor collections be best addressed?

蹲街弑〆低调 提交于 2019-12-07 13:03:02

问题


Before displaying the items from a collection, meteor seems to do some processing that leaves the client window without updates. You can see this live if you surf to http://madewith.meteor.com on a reasonable machine. My 2.6GHz 4GB RAM laptop takes about 5 seconds to render the items in the list, during which there is no indication of progress and a new user in a hurry could reasonably believe the page has finished loading.

Is there a way to incrementally display items from a collection, such that the server pushes to the client the first items of data on the wire, and the browser renders them, while new items are received? Akin to HTTP's chunked transfer.

Or is the only solution to display a spinner graphic while loading the collection, similar to what https://atmosphere.meteor.com/ does (the "doing something smart" message)?


回答1:


If you examine the xhr of the madewith app, you'll see that all (87 at this moment) apps load in the same request. So I don't think 'incrementally' displaying data is going to help in this case.

The issue is just that meteor apps take a while to initialise. I'm not sure if this can be improved in the future, but for now, yes, I think displaying a spinner is the best solution.

Regarding how to know when the data is ready, you can use the onReady callback on a collection, or see this PR for a better solution coming soon.



来源:https://stackoverflow.com/questions/12773672/how-can-the-delay-before-displaying-meteor-collections-be-best-addressed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!