Inertia resolves the page twice at first load
See original GitHub issueVersions:
@inertiajs/inertiaversion: 0.11.0@inertiajs/inertia-vueversion:0.8.0
Describe the problem:
When open the page the first time, the code inside resolve function will execute twice.
Steps to reproduce:
createInertiaApp({
resolve: (name) => {
const page = require(`./Pages/${name}`).default
page.layout = page.layout || Layout
return page
},
setup({ el, App, props, plugin }) {
Vue.use(plugin)
let vm = new Vue({
render: h => h(App, props),
}).$mount(el);
},
})
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Partial reloads - Inertia.js
Partial reloads. When making visits to the same page, it's not always necessary to fetch all of the data required for that page...
Read more >Vue page tries to send request twice. i'm using inertia, Laravel ...
i clicked store and delete one time, but both of request send twice. i had added prevent.default but it seems like not working....
Read more >Bug: useEffect runs twice on component mount (StrictMode ...
The useEffect callback runs twice for initial render, probably because the component renders twice. After state change the component renders ...
Read more >Portlet is loaded twice on one page - Forums - Liferay
Hi all, I'm currently facing a problem that the portlet I'm developing is loaded twice if the page is refreshed. My portlet is...
Read more >FOLDS & DIMENSIONS
Page 1. x. F-1-F. F-1-B. 3 5/8. 4. 2. 3. 3 11/16. 3 11/16. Inside Cover. Fold. Fold ... FOLDS & DIMENSIONS. Fold...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I tried to reproduce this issue in a new project using React, Rails and Inertia (bundled with Webpacker).
The project can be found here
Even in a newly built app, with the most recent versions of both Inertia and Inertia-rails, the page, without even providing it with props or using
usePageis rendered twice.The only solution that fixed the issue is to wrap the page function in
React.memo. I haven’t tried this in our production app so I don’t know whether or not this results in other problems but at least the render only happens once.Maybe this is something that Inertia could use under the hood?
Also facing this same issue. Any ideas how to fix it with vue3?