tmeasday / meteor-router

MIT License
366 stars 76 forks source link

Dont render new template right away after url changed. #91

Closed lastid closed 11 years ago

lastid commented 11 years ago

I'm trying to have the loading behavior like gmail when changing pages. Which is: 1) Change the url 2) Display a small loading message on top of the page 3) Request and receive data on the server 4) Change page & render the new template with received data

This will allow me to avoid a blank page during the request to the server.

It seems that with the current router, I cannot do that. Everytime I change the url, Router tries to render a template right away.

If someone knows how to achieve this, that will be great.

Thank you.

tmeasday commented 11 years ago

Hey @lastid. What you need here is a filter that returns a loading page whilst whatever you are waiting for is happening.

lastid commented 11 years ago

Well, a loading page is a blank page for me. You wont see a loading page in gmail, which is nice. When you want to change a page, you stay until the data of the next page is loaded then render the new page, in the mean time, the current page stays. It avoids current page -> loading spinner -> new page. It gives an impression of flickering. On the other hand if you do current page -> still current page with small loading message -> new page, it makes the page feel steadier.

tmeasday commented 11 years ago

Right, interesting problem. I don't think the router can handle this uses case right now, although you could probably hack something together with filters if you absolutely need it.