Skip to content

keep-alive is not supported? #26

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

Closed
ukik opened this issue Feb 9, 2020 · 3 comments
Closed

keep-alive is not supported? #26

ukik opened this issue Feb 9, 2020 · 3 comments

Comments

@ukik
Copy link

ukik commented Feb 9, 2020

I use below but nothing effect?

<keep-alive>
		<Navigator :defaultRoute="!isLoggedIn ? '/home' : '/view-habit-organisasi'"/>
</keep-alive>
@rigor789
Copy link
Member

rigor789 commented Feb 9, 2020

No, keep-alive does not work with frames (thus navigator).

What would be the expected behavior? Keeping previous routes alive? If so, just utilize the backstack, since that's what it's for.

@jadedigital
Copy link

Lets say you have bottom navigation, each displaying a different route. Each route needs to fetch data from an api before it is displayed. Ideally this data fetch would only happen once, then each route can be kept alive so that navigating back and forth between your bottom tabs is fast.

At the moment I'm using the BottomNavigation component, which does seem to keep all tabs alive. But it also seems to load all the routes upon initial render, which means all data is being fetched for each route when the app first loads and I think it's causing the initial render to take a little longer.

@rigor789
Copy link
Member

@jadedigital it's probably a good idea to delegate the fetching to a central place (like vuex) where you can cache the retrieved data.

Due to the infinite number of possibilities with view hierarchies - it's not feasible to support KeepAlive with Frames (and thus the Navigator) as they are managed by a native backstack that we don't have much control of.

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

No branches or pull requests

3 participants