nativescript-vue / nativescript-vue-navigator

A simple router for NativeScript-Vue, built on top of $navigateTo to simplify routing from within components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keep-alive is not supported?

ukik opened this issue · comments

I use below but nothing effect?

<keep-alive>
		<Navigator :defaultRoute="!isLoggedIn ? '/home' : '/view-habit-organisasi'"/>
</keep-alive>

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.

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.

@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.