Questions tagged [inertiajs]
Inertia.js allows developers to write single-page applications (SPAs) using classic server-side routing and controllers. Inertia tightly couples the backend to the frontend so that developers need not write APIs. Developers can use battle-tested server-side frameworks (e.g., Laravel, Ruby on Rails, Django, AspNetCore). On the client, developers can use React, Svelte, or Vue to implement the user interface.
1,220
questions
51
votes
5
answers
83k
views
Cleanup memory leaks on an Unmounted Component in React Hooks
I'm new using React, so this might be really simple to achieve but I can't figure it out by myself even though I've done some research. Forgive me if this is too dumb.
Context
I'm using Inertia.js ...
19
votes
3
answers
20k
views
Laravel + Inertia + Vuejs: Pagination
When I get all the records it works:
...
$items = Item::all();
return Inertia::render('Rentals/Items', ['items' => $items]
);
But when I try to paginate, it breaks down:
...
...
16
votes
5
answers
10k
views
Default Persistent Layout In Laravel + Inertia + Vite
In the previous way of setting up inertia in a laravel app, I could tweak the resolve property in the `createInertiaApp function from:
{
...,
resolve: name => import("./Pages/${name}&...
14
votes
2
answers
6k
views
Laravel Jetstream Inertia Shared Global App Data
I want to share something I figured out since there's not much info out there (that I couldn't find).
Laravel 8 with Jetstream Inertia has a few shared objects, like user, current route... You can ...
13
votes
4
answers
36k
views
All Inertia requests must receive a valid Inertia response, however a plain JSON response was received [closed]
i am trying to understand and resolve this InertiaJs error without success i hope i can get some help here.
13
votes
4
answers
4k
views
add root class to Laravel / Inertia
ok, I am going MAD...
I need to add class="h-full" to the root div inside Laravel Jetstream using Inertia. The reason for this is inside a vue file using Tailwind UI, it wants the following
...
12
votes
7
answers
11k
views
Change InertiaJS-Laravel default RootView
I am using Laravel 8 and I have installed InertiaJS, but in my directory resources/views/ I have a single file called index.blade.php which I plan to use with InertiaJS.
By default, InertiaJS looks ...
10
votes
2
answers
8k
views
Laravel 8 - Jetstream + inertia.js - Vue dev tools not working
I have a project using Laravel 8, inertia js, Vue.js and webpack.
The VueJs chrome dev tools aren't working for this project. It keeps showing as not detected, i've tried restarting it, removing and ...
10
votes
3
answers
11k
views
Tailwindcss @apply directive doesn't work inside vue component
I create a laravel application with jetstream and inertia-vue stack for my new project problem is Tailwindcs version 2 using postCss and it doesn't support @apply directive inside vue components but ...
9
votes
1
answer
8k
views
Inertiajs - Laravel: How to Throw custom Error
How isit possible to throw an custom Error from Laravel in Inertiajs.vue without redirecting then?
Vue Component:
Inertia.post('company-organisations-create', {
name: this....
9
votes
3
answers
9k
views
All Laravel routes exposed. How to move it to app.js or minify if possible
I am using Ziggy for my Laravel, Vue.js and Inertia js project. In the view page source, I can clearly see all of the Laravel routes.
<script type="text/javascript">
const Ziggy = {...
8
votes
5
answers
8k
views
Accessing Laravel's .env variables inside Inertia.js Vue files
I am starting with the Inertia Laravel example https://github.com/drehimself/inertia-example
which is nothing but Laravel with Vue in one monolithic codebase, using Inertia.js:
https://github.com/...
8
votes
3
answers
5k
views
how to access the relationships via models in laravel 8 inertia
I have a relation one to many between users table and areas table , when i return profile data i get area_id from users table, i need to get area name using models.
Is there a way to get area name in ...
8
votes
3
answers
8k
views
Tailwind CSS unnecessary whitespace
I'm trying to use this admin starter template I found on the tailwind toolbox and I am trying to customise it to my liking. I've split the code from the template down into 3 separate files, shown ...
8
votes
1
answer
3k
views
How to undo Inertia.js from my Laravel application
I have a problem with undoing Inertia.js in my application. When I started my application, I accidentally typed both commands.
php artisan jetstream:install inertia --teams
After a while when I saw ...
8
votes
4
answers
6k
views
how can I use bootstrap instead of tailwind CSS in vue.js welcome component
I install jetstream+inertia.js into my laravel project and everything is working perfectly but I need to use bootstrap 5 in only welcome. vue component so how can I handle it?
My app.js file;
require('...
7
votes
1
answer
16k
views
Redirect route with data in Laravel Vue Inertia stack
In my controller i have
public function store(Request $request)
{
$postData = $this->validate($request, [
'name' => 'required',
'status' => 'required | ...
7
votes
5
answers
18k
views
Mixed Content: The page at 'domain' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint
I've been trying to resolve an error that happens only in production. When I try to create a new database entry, following errors are thrown:
Mixed Content: The page at 'https://strong-moebel.art/...
7
votes
2
answers
4k
views
Vue3/Inertia Failed to resolve component
I have a application which is built with the VILT-stack (Vue, Inertia, Laravel, Tailwind). I have some components like cards which could be used everywhere in the application. Because I don't want to ...
7
votes
2
answers
7k
views
Define global component in InertiaJS with Vue 3
I'm trying to build an application on Laravel 8.38 - InertiaJS 0.8.4 I'm using Vue 3 as my frontend stack.
I've multiple layouts which I need to register globally as Vue Component, so that I can use ...
6
votes
4
answers
19k
views
Laravel 8 jetstream stack inertia. Redirect to Home after Login, instead of users choice
What happens to me is that if the user puts the url: project.test/med, the system redirects to Login but then it does not redirect to dashboard but to med. In RedirectIfAuthenticated the expression ...
6
votes
2
answers
10k
views
How to Add Roles and Permission to Laravel Fortify + Inertia + vue?
my project use laravel fortify, inertia with vue. i have to add role based permissions (just like spatie permissions package). i'm still a beginner to fortify and inertia. but i have experience in ...
6
votes
5
answers
4k
views
Using layout property in <script setup> tag
Is there any way to use layout property of inertiajs for vue 3 in <script setup> tag?
In other words, I am asking for an equivalent of the following code,
<script>
import from "../...
6
votes
3
answers
7k
views
Getting View [app] not found error in my Inertia laravel app
I'm trying to use inertia in my laravel app. My app doesn't need jetstream so I won't be using that. So I went to inertia's site https://inertiajs.com/ to install it, but I'm not sure if I'm doing it ...
6
votes
1
answer
2k
views
How should I support localization for my project with Laravel with Vue using Inertia?
I am intermediate in Laravel. I have some published projects in Laravel for my clients.
I started a Project with Laravel with Vue using Inertia. I used a starter kit of Laravel 10 with the breeze and ...
6
votes
2
answers
2k
views
How to preserve current GET url in the browser while making POST request to server in Laravel-8 and InertiaJs
I am using Inertia JS in Laravel 8, with following POST request to server. The problem is that the browser URL is also updated with POST request, which may be a expected behavior in some cases but I ...
6
votes
1
answer
23k
views
Correctly redirect to another page with inertia?
I"m trying to redirect on click to another page, for some reason it's not working. This is the code on my vue where the redirect buttons are. I've tried two different ways and neither are working....
5
votes
1
answer
11k
views
Laravel & inertia.js file download
I uploaded a file to the database and created Storage link using "php artisan storage:link" and everything work perfectly but when I want to download the file I face this error
here's my ...
5
votes
2
answers
6k
views
Error when using BootStrap 5 with Adonis and Inertia, with scss support
Error when using BootStrap with Adonis and Inertia, with scss support.
I've been trying for days to make it work and I can't. Below is the configuration.
Would anyone know how I can resolve this issue?...
5
votes
3
answers
4k
views
Using 2 different blade root template for Vue, with Laravel 8 and Inertia?
So I am working on a Laravel 8 app, with Inertia and Vue.
The idea is that most of the pages are Laravel + Blade (good for SEO, fast loading etc...), but for selected pages that need a lot of user ...
5
votes
3
answers
5k
views
getting _ctx.route is not a function
I am trying to use ziggy by importing in laravel inertiajs app (VUE3) without using @routes but i not able to use eg. route('home').getting ctx.route is not a function error.. Please tell me how this ...
5
votes
2
answers
12k
views
Route with multiple parameter InertiaJS
I am using Laravel 8 with InertiaJS stack.
I am using model binding on route and resource controller.
is it possible to send multiple parameter on route() function in inertia?
I cant get the request (...
5
votes
1
answer
1k
views
Laravel 9 login as another user
I want to be able to login as another user from my administrator account.
I'm making a SPA application with Inertia Js using laravel fortify to handle sessions and login.
In laravel 8 i was able to ...
5
votes
4
answers
10k
views
How to upload files with inertia js and laravel 8.0
I have an update ( patch form ) that can have some basic fields with one featured image and an array of gallery images.
updatePhotoPreview(event) {
this.featuredImagePreview = URL.createObjectURL(...
5
votes
1
answer
18k
views
How to setup inertia on my project, gives me an error when I try and load the login page
I'm trying to setup Inertia to use in my Laravel project but it gives me errors? Where is my mistake?
I installed Inertia with this command
composer require inertiajs/inertia-laravel
followed the ...
5
votes
1
answer
658
views
What are #tags on vue template?
I can't find any documentation that explains what #tags are on <template>
Example:
<script setup>
import { ref } from 'vue';
import { useForm } from '@inertiajs/inertia-vue3';
import ...
5
votes
1
answer
1k
views
Laravel Application | Only Safari is sometimes missing XSRF Cookie on Requests
We've recently deployed a Laravel Application and experienced some weird issues with Some Safari Versions on our application.
When surfing on our applications, especially if the user is not authorized,...
5
votes
2
answers
3k
views
Laravel Fortify Return Inertia::render() instead of a blade view
I'm currently building a SPA with vue and installed jetstream (that comes with fortify) and using inertiajs to get my vue components. Is there a way to use inertia::render('') when i use Fortify::...
5
votes
3
answers
3k
views
How to add _token csrf globally on Laravel Inertia?
I have a project with Laravel Inertia and Vue Js. These day i have a problem with csrf token. I have already read the documentation here https://inertiajs.com/csrf-protection, so maybe i should add ...
5
votes
0
answers
1k
views
Laravel Vue3 and Vite Rollups - Fails dynamic imports
I've been spending some time rewriting an application to Laravel 9 with Inertia, Vite, Vue3 Composition API, and Typescript.
Everything went good and when I tested the production build on my local ...
5
votes
1
answer
2k
views
Laravel Vite build for production (Inertia) - unknown dynamic import
I am currently trying to create a production build of Laravel / Vite /Inertia, when completing the build (npm run build) I have tried using the bundle but I get the following error:
Uncaught (in ...
5
votes
1
answer
1k
views
vue vite dynamic components import
I am migrating an existing laravel ineria from mix to vit.
I did all the steps in the migration guid and everything works fine except for one thing.
I have a component receives a prop conatains an ...
5
votes
0
answers
446
views
How to load vuetify 3 to inertiajs(laravel 8)
how do i load vuetify 3(alpha) into my app while using inertiajs (vue3 installed), currently my app.js look like this:
require('./bootstrap');
import { InertiaProgress } from '@inertiajs/progress';
...
5
votes
1
answer
630
views
Can you use Inertiajs with React Native?
I'm just about to start developing my first iOS app with React Native and wasn't sure if Inertiajs would be suitable.
Thanks for your help!
4
votes
2
answers
19k
views
Inertia: Reload page with updated data without modifying scroll position
I'm using Inertia/Laravel/VueJs. I have a page with many posts and each post can be marked as completed. When a post is marked as completed on the front-end I have a v-bind which toggles a CSS class ...
4
votes
2
answers
7k
views
Wrong laravel mix rewrite url path when place project in subfolder
I have deployed laravel react application on the server, inside a folder namely patients/ so the complete URL for the app is domain.com/patients
app.js and app.css files are not found, I am facing a ...
4
votes
1
answer
4k
views
Laravel + Inertia + Vue.js Duplicates App_URL into url
I have been working on a Laravel 8 Inertia and Vue.js project for a couple of weeks without this problem.
My files were residing in C:\Users[my_user]\laravel. I was using the artisan command serve ...
4
votes
2
answers
11k
views
uploading files from Laravel to azure blob storage
I was given a task to maintain a Laravel project with Vue.js (inertia) (not very experienced with both). Now we need to switch the host to Azure and I am stuck on the file storage. Specifically, I am ...
4
votes
3
answers
4k
views
Error: Uncaught (in promise) TypeError: n.swapComponent is not a function
I am developing an application using Laravel with Jetsream and the Vuejs & Inertia stack and am getting a blank page across my application after running npm audit fix.
I ran the npm command npm ...
4
votes
1
answer
4k
views
How to preserve-scroll with buttons using inertia js
Working
<Link :href="route('products')" preserve-scroll>Products</Link>
Not Working
<form @submit.prevent="submit">
...
<button type="submit" ...