Replies: 5 comments 7 replies
-
I think there's currently no (easy) way to achieve this with Inertia, because of its protocol. The response contains which component should be rendered, so Inertia isn't aware of which component should be rendered before the XHR response is returned. |
Beta Was this translation helpful? Give feedback.
-
Hey @7ammer If you want to stick to Inertia all the way you can use lazy data evaluation to render the component and then fetch additional data with a second partial visit, that replaces the initial one and preserves state , simple Laravel/Vue example: return Inertia::render('Users', [
...
'users' => Inertia::lazy(fn () => User::get()),
]); onMounted(() => {
Inertia.visit('/users', {
preserveState: true,
replace: true,
only: ['users'],
});
}); This will immediately render the Users-component and fetch the users afterwards. |
Beta Was this translation helpful? Give feedback.
-
This is also a crutial "option" for me. There are many downsides to rendering all the templates on the frontend (duplication of logic, required tooling/compilation, etc.). But the main advantage in my opinion is to have an app that feels really quick and snappy. At the moment Inertia is really convenient over a traditional Vue Router setup but it feels much slower. I would then stick to a much simpler setup with Blade views + JS sprinkles. I think the proposed placeholder feature is a good first step. Is the code available somewhere? It could be a good starting point for a PR if you're open to it. |
Beta Was this translation helpful? Give feedback.
-
I think this is where Inertia should go in the future. I started thinking, what's the point of the Single Page App if the pages don't load instantly? Is it really that different experience from the old fashioned, static websites? Slightly. Is it worth all the hassle if we don't get the immediate response anyway? What's the difference if the loading bar is in the body (if we use |
Beta Was this translation helpful? Give feedback.
-
are there any updates on this topic? |
Beta Was this translation helpful? Give feedback.
-
Hello 👋
I'm looking into Inertia and it seems that if you navigate to a page it waits for the data BEFORE rendering the template. While this keeps things nice and simple it would be nice to also have the ability to be able to render the page/template and THEN load the page data with loading states. This is the kind of experience I would expect in a mobile application. Can it be achieved in Inertia?
All the website's templates are (or at least can be) stored in a bundle.js file when the website first loads, right?
Beta Was this translation helpful? Give feedback.
All reactions