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

Option to warm up the next route #110

Open
ericraio opened this issue Apr 4, 2016 · 15 comments
Open

Option to warm up the next route #110

ericraio opened this issue Apr 4, 2016 · 15 comments

Comments

@ericraio
Copy link
Contributor

ericraio commented Apr 4, 2016

I currently have a welcome screen where 8 out of 10 times, they are going to click on a specific button.

A web browser has the ability to pre-load the next route and render the page in the background.

It would be nice if i could some how pre-load the next "toRoute" matching a specific criteria so when the user taps on the button, the next page is already loaded with data and can make the app feel snappier in the beginning.

@charpeni
Copy link
Contributor

charpeni commented Apr 5, 2016

I like that !

@davidLeonardi
Copy link
Contributor

@eric: Do you have an idea on how that could be implmented? I'd love to
help you get that done.

On Tue, Apr 5, 2016 at 2:48 PM Nicolas Charpentier [email protected]
wrote:

I love that !


You are receiving this because you are subscribed to this thread.

Reply to this email directly or view it on GitHub
#110 (comment)

@ericraio
Copy link
Contributor Author

ericraio commented Apr 6, 2016

@SEthX I'm not quite sure how to implement this but I think it might be a similar concept when you have a route stack and you are "swipping" to go back and you can already see the previous screen layered underneath, I think navigator handles this but would need to look at the source code and reverse engineer it going the other direction

@charpeni
Copy link
Contributor

charpeni commented Apr 6, 2016

I think we maybe able to achieve this with prop initialRouteStack or method immediatelyResetRouteStack(routeStack).

initialRouteStack [object]

Provide a set of routes to initially mount. Required if no initialRoute is provided. Otherwise, it will default to an array containing only the initialRoute

Navigator API provide methods to navigate to an existing scene without unmounting :

jumpBack() - Jump backward without unmounting the current scene
jumpForward() - Jump forward to the next scene in the route stack
jumpTo(route) - Transition to an existing scene without unmounting

I guess jumpTo will do the same thing as swiping back to the previous route.

We could pre-render or warm up most used scenes and navigate with jumpTo(). Also, I think we should add a method that acts like jumpTo() but that also move the scene to the end of the route stack. Alternatively, a method that jumpTo and push to the end of the route stack if scene is already mounted OR push that new scene if it doesn't exist would be interesting too.

Thoughts?

@ericraio
Copy link
Contributor Author

ericraio commented Apr 6, 2016

@charpeni great find! That seems like it would work. From an interface perspective. I was thinking I could call a function in the componentDidMount where I can preload a route and the next time "toRoute" is called matching a preloaded scene, it would go to the mounted scene instead of mounting another.

In my welcome screen, if they don't hit "Start" for an example and the start button goes to the Home Screen, at some point they will land at Home and I would like it to be loaded and ready.

What do ya think?

@charpeni
Copy link
Contributor

charpeni commented Apr 7, 2016

Nice perspective, I have the same use case as I need to pre-render a WebView to avoid the waiting of the user while loading.

It would go to the mounted scene instead of mount another.

It should push that existing scene to the end of the route stack to be able to back to the previous scene.

@ericraio
Copy link
Contributor Author

ericraio commented Apr 7, 2016

@charpeni yeah that makes sense

@ericraio
Copy link
Contributor Author

ericraio commented Apr 8, 2016

@charpeni are you able to start this? I can help out where needed

@charpeni
Copy link
Contributor

charpeni commented Apr 8, 2016

I can't start this right now, I have other priorities to deal with but I'll need it in a few weeks, so I'll keep you up-to-date. Feel free to look at it if you have time :)

@ericraio
Copy link
Contributor Author

ericraio commented Apr 8, 2016

@charpeni yeah same here, i should be able to look into this in a week or 2

@charpeni
Copy link
Contributor

charpeni commented Apr 8, 2016

@SEthX ? :D

@davidLeonardi
Copy link
Contributor

I might give it a shot this week, my workload is decreasing so i have some
time
On Fri, 8 Apr 2016 at 17:40, Nicolas Charpentier [email protected]
wrote:

@SEthX https://github.com/sethx ? :D


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#110 (comment)

@ericraio
Copy link
Contributor Author

@SEthX hey seth, were you able to get a chance to look at this? :)

@davidLeonardi
Copy link
Contributor

Ive been sick all week unfortunately. Hopefully i feel better soon!
On Thu, 14 Apr 2016 at 00:20, Eric Raio [email protected] wrote:

@SEthX https://github.com/sethx hey seth, were you able to get a chance
to look at this? :)


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#110 (comment)

@ericraio
Copy link
Contributor Author

@SEthX get well soon!! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants