We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
routes:
const routes: RouteRecordRaw[] = [ { path: '/', component: () => import('layouts/MainLayout.vue'), children: [ { path: '', component: () => import('pages/DynamicPage.vue'), props: () => ({ path: 'main' }), }, { path: ':path?', component: () => import('pages/DynamicPage.vue'), props: (route) => ({ path: route?.params?.path ?? 'main' }), }, ], },
MainLayout:
defineOptions({ async preFetch() { const store = usePagesStore(); await store.getPages(); return store.pages.length > 0; }, });
Store:
export const usePagesStore = defineStore('pages', () => { const { resolveClient } = useApolloClient(); const client = resolveClient(); const pages = ref([]); const getPages = async () => { const res = await client.query({ query: getAllPages }); console.log('GET PAGES!', res.data.pages.data.length); pages.value = res.data?.pages?.data ?? pages.value; }; return { getPages, pages, }; });
quasar.conf:
prefetch: true, ssg: { routes: async () => { const res = await axios.get(`${process.env.API_URI}/pages`); return res.data.data.map(({ attributes }) => attributes.path ?? ''); }, shouldPrefetch: () => true, shouldPreload: () => true, // crawler: true, },
Excepted: all generated pages have initial data; Result: only one of the generated pages have non empty INITIAL_STATE
The text was updated successfully, but these errors were encountered:
so, how to force prefetch to work on every page?
Sorry, something went wrong.
No branches or pull requests
routes:
MainLayout:
Store:
quasar.conf:
Excepted: all generated pages have initial data;
Result: only one of the generated pages have non empty INITIAL_STATE
The text was updated successfully, but these errors were encountered: