mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 19:22:14 +01:00
upgrade inertia v2; add prefetching; migrate queries to tanstack query
vue
This commit is contained in:
@@ -6,11 +6,13 @@ import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
|
||||
import { ZiggyVue } from '../../vendor/tightenco/ziggy';
|
||||
import { createPinia } from 'pinia';
|
||||
import type { User } from '@/types/models';
|
||||
import { VueQueryPlugin } from '@tanstack/vue-query';
|
||||
import { QueryClient, VueQueryPlugin } from '@tanstack/vue-query';
|
||||
import { type DefineComponent } from 'vue';
|
||||
import { setupPrefetching } from '@/utils/prefetch';
|
||||
|
||||
const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
|
||||
const pinia = createPinia();
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
createInertiaApp({
|
||||
title: (title) => `${title} - ${appName}`,
|
||||
@@ -62,7 +64,10 @@ createInertiaApp({
|
||||
return page.props.auth.user.timezone;
|
||||
};
|
||||
|
||||
app.use(plugin).use(pinia).use(ZiggyVue).use(VueQueryPlugin).mount(el);
|
||||
app.use(plugin).use(pinia).use(ZiggyVue).use(VueQueryPlugin, { queryClient }).mount(el);
|
||||
|
||||
// Setup Inertia prefetching to warm TanStack Query cache
|
||||
setupPrefetching(queryClient);
|
||||
},
|
||||
|
||||
progress: {
|
||||
|
||||
Reference in New Issue
Block a user