Hey, I try to implement Inertia into a very large application. In the beginning I can only replace some parts of the app, so I run into the problem that I can't use <inertia-link /> there. It's because whenever I link into a legacy part of the app, the link will be opened in a modal. Since this is cool for something like error pages, it would be great to have an option to change that behavior. What do you think?
So, early on in my Inertia development I tried to make it that when a non-Inertia response comes back from the XHR request, it would automatically display that as the current page, instead of in a modal. However, this was not possible to get working properly, especially when it came to history management, despite both @adamwathan and my best efforts. We seriously spent a _ton_ of time on this...and our determination was that it couldn't be done.
That said, Inertia can totally work in an app that has some Inertia pages, and some server-side rendered pages. If you have pages in your app that are not Inertia pages, simply make those visits using normal links, and not using <inertia-link>. If you are making an Inertia request, you must return an Inertia response.
Thanks for your explanation!
I am struggling with something similar. I've got a mixed app. which renders a single inertia driven page from a dedicated controller. In my controller upon update of resource I do
public function update()
{
...
return \Redirect::route('alphabet')->with('success', 'Terms updated.');
}
No matter why I do, the alphabet (non inertia/vue route) page comes up in a modal.
Looking at your code I've tried to set x-inertia to true
public function update()
{
...
$headers[] = ['x-inertia'=>true];
return \Redirect::route('alphabet')->with('success', 'Terms updated.');
}
but this doesn't seem to have an effect either.
Most helpful comment
So, early on in my Inertia development I tried to make it that when a non-Inertia response comes back from the XHR request, it would automatically display that as the current page, instead of in a modal. However, this was not possible to get working properly, especially when it came to history management, despite both @adamwathan and my best efforts. We seriously spent a _ton_ of time on this...and our determination was that it couldn't be done.
That said, Inertia can totally work in an app that has some Inertia pages, and some server-side rendered pages. If you have pages in your app that are not Inertia pages, simply make those visits using normal links, and not using
<inertia-link>. If you are making an Inertia request, you must return an Inertia response.