inertia-laravel
inertia-laravel copied to clipboard
CreateInertiaApp loads twice
Hi,
After we've setup our laravel + inertia app we found out that CreateInertiaApp() runs twice.
//app.js
import { createApp, h } from "vue";
import { createInertiaApp } from "@inertiajs/inertia-vue3";
import DefaultLayout from "../../views/layouts/default";
import { createPinia } from "pinia";
import { importComponent } from "./import-component.js";
import { ZiggyVue } from "ziggy";
import { Ziggy } from "../../js/ziggy";
import { InertiaProgress } from "@inertiajs/progress";
InertiaProgress.init();
createInertiaApp({
resolve: (name) => {
console.log("123");
const component = importComponent(name);
// Set default layout if no layout specified on component
component.default.layout ??= DefaultLayout;
return component;
},
setup({ el, App, props, plugin }) {
const pinia = createPinia();
const app = createApp({ render: () => h(App, props) })
.use(plugin)
.use(pinia)
.mixin({ methods: { route: window.route } })
.use(ZiggyVue, Ziggy);
// added ziggy route helper
// shows laravel routes in vue
app.config.globalProperties.$auth = props.initialPage.props.auth;
app.mount(el);
},
});
//webpack.mix.js
mix
.js("resources/assets/js/app.js", "public/js")
.sass("resources/assets/sass/app.scss", "public/css")
.webpackConfig(aliasesConfig)
.sourceMaps()
.vue({ version: 3 })
.ziggy()
.version();

Can you guys help us ?
Kind reminder @reinink
Same happening with me on react, where components are being rendered twice.
Same here... any ideas?
See https://github.com/inertiajs/inertia/issues/1091 and https://github.com/inertiajs/inertia/pull/1608
Alright @jessarcher, we can see that 1 PR (which is closed) and 1 issue (also closed for no apparent reason) that you linked here. What should we do next? "completed" what?