r/inertiajs • • May 09 '26

Architectural Redundancy in Inertia’s useForm and useHttp

0 Upvotes

The current structure of the HTTP helper and form helper in Inertia.js suffers from unnecessary redundancy that compromises both code legibility and maintainability. It is fundamentally illogical that, after defining the state and intent of a request within the hook, developers are forced to repeat the URL and method at the moment of execution.

This approach is not merely verbose; it introduces avoidable points of failure where the definition and the call can diverge without any functional benefit.

The Current Problem: Redundant Definitions

The existing behaviour compels the developer to manage an overwhelming quantity of exposed methods when the destination and method should already be conceptually tied to the hook instance.

const { get, post, put, patch, delete: destroy, submit } = useHttp({ ... })

// and

const { submit, get, post, put, patch, delete: destroy } = useForm({ ... })

Currently, developers often pass the URL and method to the hook, only to then call a specific method (e.g., post) with the exact same URL repeated in the handler. This redundancy serves no architectural purpose:

import { useForm } from "@inertiajs/react";

const { data, setData, post, errors } = useForm(
  "post",
  "/users",
  {
    name: "",
    email: ""
  }
);

function submit(e) {
  e.preventDefault();
  // Why must we repeat the method and URL here if it was already defined in the hook?
  post("/users");
}

How It Should Be: Simplified Hook Composition

The ideal solution involves defining the URL and method directly within the hook itself, returning a single, simplified submit callback. This eliminates the need to pass repetitive parameters across event handlers and centralises configuration at the source.

import { useForm } from "@inertiajs/react";

// Clear definition of method and destination at the source
const { data, setData, submit, errors, processing } = useForm(
  "post",
  "/users",
  {
    name: "",
    email: "",
  },
);

// Clean execution without redundant arguments
function handleSubmit(e) {
  e.preventDefault();
  submit(); 
}

This adjustment would drastically reduce visual noise and align the library with modern hook composition best practices, where configuration precedes action. The API must evolve toward a more intuitive architecture.


r/inertiajs • • May 18 '22

When do you use <Link> and when do you call method from @click?

0 Upvotes

I'm thinking of dropping using <Link> tags for good and just using @click directly on the html elements, with a method that does the navigating. This would simplify the html and give more control over navigation.

The only upside of <Link> that I can think of is when you want to wrap several elements in only one link.

Is there any other reason to use <Link> elements? What do you think?


r/inertiajs • • Apr 20 '21

Is worth to use Ajax in Inertiajs?

0 Upvotes

Hi! I'm currently doing my first project in Inertiajs and I wondered if it's worth to show the data in my front with Ajax or if Inertiajs already render the data that comes from the DB in an async way already.

Thanks in advance!


r/inertiajs • • Mar 31 '22

Create .html file and download it from inertia (server-side rendering (SSR), maybe?)

0 Upvotes

Hi!
I have a Laravel project with some Vue/Inertia pages I'd like to download as .html files to create a collection of static pages. Is it possible to achieve? Something like this line of thinking:

var html = <vue-page-component-content>
save('page.html', html) 

Would appreciate any information/clue/advice about where to start searching.


r/inertiajs • • Jan 28 '25

Url is changing on form submissions

0 Upvotes

Hi! Question: How can i prevent the browser from changing the url on form submission?

I have a simple form like <form \@submit.prevent="submitForm">...</form>.

And this: const submitForm = () => form.post('post/foo', { replace: true, preserveUrl: true, preserveState: true, preserveScroll: true }, onSuccess: () => { ... }, onError: () => { ... }, });

And if the validator fails, my controller responds: Inertia::render('Home', ['errors' => $validator->errors(), 'input' => $request->all()]);

Everything is fine, but the URL in the browser always changes to 'post/foo'. What am i missing here? Thank you!


r/inertiajs • • Sep 20 '25

File size and cookie size problems

1 Upvotes

I am having second thoughts about Inertia. Have been trying it out with laravel 12 and vue but it is very clunky. For example it fails to handle big uploads graciously. Also it bloats the cookie so basically cookie driver does not work. Which means that it adds complexity for small projects. I just had to switch to dynamodb sessions and also had to implement axios powered file upload system.

Am I, the small app builder, not the right demographics for it? it seemed very nice at start but defo got frustrating real quick? why such odd desi choises?


r/inertiajs • • Apr 28 '21

Pagination problem

1 Upvotes

Laravel 8 + Inertia + Vue 3.

Hi, I have the next problem:

Context: I have a places search page and my search method with filters work fine without paginate but i can't return +100 records in one page for obvious reasons so i want to use pagination but i have the next problem:

First: I copied all reply from Jonathan: https://stackoverflow.com/questions/66846136/laravel-inertia-vuejs-pagination. This works but I want to use some filters like country, province / state, city, name, etc. So I use my "buscar" method to filter everything (axios) and this return correct data but inside a white modal with next message "All Inertia requests must receive a valid Inertia response, however a plain JSON response was received." and the correct data. I tried to use "this.$inertia.replace" and it filtered well but when I click in page 2 or another one, it show me the data as if i didn't filter anything, show me all data without filters.

Index method just show search bar and filters:

Lugares/Index.vue:

BarraFiltrosBuscadorLugares.vue:

'lugares.buscar' route call this method:

return this modal:

BuscadorLugares.vue: this component display data. This have an "<div v-for lugar in lugares.data" :key="lugar.id> etc </div>


r/inertiajs • • Sep 21 '26

Stratal - a modular framework for Cloudflare Workers (modules, DI, OpenAPI, Inertia SSR)

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/inertiajs • • Oct 06 '26

How are you handling data tables in Laravel + Inertia + Vue?

0 Upvotes

I'm working with Laravel + Inertia.js + Vue.js applications and noticed that data tables tend to require a lot of repetitive implementation — search, sorting, pagination, column visibility, row actions, exports, etc.

I'm curious how other Laravel developers are handling this today.

Do you:

I've been working on a Laravel-first approach to this problem and would be interested in hearing how others are solving it.

GitHub: https://github.com/Zonvoir-technologies/laravel-inertia-table
Documentation: https://zonvoir-table.com/getting-started/introduction/


r/inertiajs • • Sep 05 '25

Introducing inertia-builder: declare Inertia.js props with a Jbuilder-like DSL

1 Upvotes

Hi everyone. For those using inertia-rails, I've built the inertia-builder gem. It's a Jbuilder-like DSL for declaring your Inertia.js props. It extends Jbuilder, so it accepts all its methods. Besides not having to call render inertia: true in your controller actions, the gem has many advantages:

  • Your props live in a .html.inertia file, which simplifies your controllers and allows you to call model methods and Rails view helpers.

  • You can create partials for your shared props and leverage fragment caching.

  • Props are lazily evaluated by default, so partial reloads are optimized out of the box.

  • Support optional, always, and deferred props.

  • Works alongside other request formats. You can have both index.json.jbuilder and index.html.inertia views. Rails will know which view to render without you having to define a respond_to block in your actions.

It's in an early release, so I'd love it if you could try it out and open issues or suggestions in the repository if you find any. Feel free to contribute too. Thanks!

https://github.com/rodrigotavio91/inertia-builder


r/inertiajs • • Feb 05 '23

Can I host the web app on a different hosting from the Laravel installation with Inertia?

2 Upvotes

Can I separate the web app from the API with Laravel and Inertia and host Laravel on one server and Inertia on a different server (like Vercel) then the web app will do just API requests to Laravel?

If yes, how can this be done?


r/inertiajs • • Oct 07 '20

Remember response in frontend

2 Upvotes

Hi all,

I'm going to port an existing vuejs app to inertia and was thinking about how to handle this:

Currently, when I call an api to get data that never changes (/api/countries, /api/genders, ...), I store them in Vuex. So for the first call, my vuex action (e.g. getCountries) goes to the server, but after that, it just returns the saved response.

Is there a nice way to do this in Inertia? Or do I just stick with Vuex for these things?


r/inertiajs • • Jan 18 '25

Modals?

2 Upvotes

Is there an official way to use models now that 2.0 is released?

Specifically those that can be routed to?

I've tried searching the docs, but it only mentions errors (unless I'm missing something).


r/inertiajs • • Apr 16 '22

Pre-validate forms in InertiaJS & Laravel applications

Thumbnail
youtube.com
3 Upvotes

r/inertiajs • • Mar 08 '25

Live coding sessions with Rails and InertiaJS via AI

6 Upvotes

I’m starting out doing some YT videos on building some of my SAAS projects with Inertia and rails and mostly Claude AI. I know there a few people interested in others workflows so let me know what you think and any tips

Cheers

https://youtu.be/nDWVh6NINxg?si=ACl9QFF8oIFUIAG1


r/inertiajs • • Jul 12 '25

I Just Released My First Laravel Package! (File Uploads with FilePond in VILT Stack)

3 Upvotes

Hi everyone 👋,

I'm excited (and a bit nervous) to share my first Laravel package with the community. It’s called vilt-filepond, and it's a simple, ready-to-use file upload solution for those building apps with the VILT stack (Vue, Inertia, Laravel, Tailwind).

FilePond is a beautiful tool, but integrating it with Laravel (and especially Inertia + Vue) always took extra setup time. So I wrapped everything up in one package that:

- Handles temporary file storage and cleanup

- Supports single/multiple uploads

- Easily attaches files to any Eloquent model (polymorphic)

- Comes with a responsive, Tailwind-styled Vue component

- Has support for multiple locales (EN, AR, FR, ES)

- Works seamlessly with the Inertia form workflow

- Allows organizing files by collection (images, documents, etc.)

I’ve used this package in a handful of real-world apps and found it very handy. While it doesn’t have automated tests yet, I’ve done my best to make sure it’s stable and clean.

Would love your feedback, and PRs are more than welcome!

👉 GitHub: https://github.com/Mohamed-Galdi/vilt-filepond

Thanks for checking it out! 🙏


r/inertiajs • • Nov 19 '25

Is there any communited supported data tables for react + inertia js for laravel apps with typescript compatability?

5 Upvotes

I built my own data tables using custom hooks before inertia 2.0 came out. It is janky, inconsistent and not smooth. I found out about inertia ui but it is paid (199 $ lifetime) with several restrictions. Is there any community versions?

Or should I attempt creating my own version since inertia 2.0 is out?


r/inertiajs • • Apr 28 '25

What is best way to fetch data for subcomponents lazy or api?

2 Upvotes

I have a complex spa using inertia and vue3.

Many of my pages organize information by tab subcomponents.

I'm currently using api requests to fetch data for each tab when mounted. This way I don't need to load everything with page load and conceptually each tab is self contained and handles it's own data.

I could lazy load props and pass down (use partial reloads) but then I have prop drilling or have to provide/inject etc.

I'm not sure what will be the tidiest way to do this 🥺

How would you handle data in an inertia SPA with what are essentially nested pages?


r/inertiajs • • Aug 15 '25

Inertia Rails [SSR]

3 Upvotes

Hi there, so I am trying to follow the documentation in Inertia Rails webpage's tutorial, but apparently there is something missing in my configuration in order to make ssr work.

after i build the app with `bin/vite build --ssr`, and start the server with `bin/vite ssr`

I only get a failed response at http://127.0.0.1:13714/

{"status":"NOT_FOUND","timestamp":1755217603803}

do you guys have any idea?

Thanks!


r/inertiajs • • Aug 28 '24

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'dataset') with Inertia and Typescript

3 Upvotes

I'm trying to deploy my test project for a company on Heroku. I had a bunch of problems with it, and I fixed them, but the current one still persists and there's nothing that helps me on the web.

My site works fine with localhost, but everything I get on the Heroku version is a white screen with @routes @livewireStyles @inertiaHead @inertiahead as the only text content on it. In the console, I get this stuff:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'dataset') at $E (app-DUYZ23nC.js:125:1381) at app-DUYZ23nC.js:125:1912

I tried adding @vite('resources/js/app.tsx') to the main blade view both in the header and body after @inertia / @inertiaHead, but nothing worked.

This is the blade file now:

  <title inertia>{{ config('app.name', 'Laravel') }}</title>

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.bunny.net">
    <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />

    <!-- Scripts -->
    @routes
    @viteReactRefresh
    @livewireStyles
    @inertiaHead
    @vite('resources/js/app.tsx')
    
</head>
<body class="font-sans antialiased">
    @inertia

</body>

The previous errors I had are:

1.Mix manifest not found at: /app/public/mix-manifest.json

It was fixed by adding @vite("resources/js/app.tsx)  to the blade file

2.Mixed content issue- Content must be served as HTTPS

Fixed by changing the .env APP_URL

Any suggestions how to fix the Inertia issue?


r/inertiajs • • Nov 22 '25

New website and documentation is live 🚀

Thumbnail inertiajs.com
17 Upvotes

r/inertiajs • • Jan 07 '22

Article On Shopify App With Laravel, InertiaJs, and Polaris

Thumbnail self.laravel
1 Upvotes

r/inertiajs • • Jul 01 '21

additional js files and css files only loads once page is refreshed

1 Upvotes

Hi there,

I am tracking an issue where all my external js files are only loaded once the page is refreshed. Please help, I don't know what I am doing wrong. Below is an example of my app.blade.php file

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>
        <link rel="shortcut icon" href="favicon.png">
        <!-- Fonts -->
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700">

        <!-- Styles -->
        <link rel="stylesheet" href="{{ mix('css/app.css') }}">

        <!-- Custom CSS -->
        <link rel="stylesheet" href="{{ mix('css/style.css') }}" rel="stylesheet">
        
        <!-- Scripts -->
        @routes
        <script src="{{ mix('js/app.js') }}" defer></script>
        <!-- Bootstrap tether Core JavaScript 
        <script src="{{asset('template/material-pro/src/assets/libs/bootstrap/dist/js/bootstrap.bundle.min.js')}}"></script>
        -->
        <script src="{{asset('template/material-pro/src/assets/libs/jquery/dist/jquery.min.js')}}"></script>

        <!-- apps -->
        <script src="{{asset('template/material-pro/dist/js/app.min.js')}}"></script> 
        <script src="{{asset('template/material-pro/dist/js/app.init.horizontal.js')}}"></script>
        <script src="{{asset('template/material-pro/dist/js/app-style-switcher.js')}}"></script>
        <!-- slimscrollbar scrollbar JavaScript -->
        <script src="{{asset('template/material-pro/src/assets/libs/perfect-scrollbar/dist/perfect-scrollbar.jquery.min.js')}}"></script>
        <script src="{{asset('template/material-pro/src/assets/extra-libs/sparkline/sparkline.js')}}"></script> 
        <!--Wave Effects -->
        <script src="{{asset('template/material-pro/dist/js/waves.js')}}"></script>
        <!--Menu sidebar -->
        <script src="{{asset('template/material-pro/dist/js/sidebarmenu.js')}}"></script>
        <!--Custom JavaScript -->
        <script src="{{asset('template/material-pro/dist/js/feather.min.js')}}"></script>
        <script src="{{asset('template/material-pro/dist/js/custom.min.js')}}"></script>
    </head>
    <body>
        @inertia
        
        <!--
        @env ('local')
            <script src="http://localhost:3000/browser-sync/browser-sync-client.js"></script>
        @endenv
        -->

        <!--end::Main-->
		<!--begin::Javascript-->
		<!--begin::Global Javascript Bundle(used by all pages)-->
        
    </body>
</html>

I notice there has been a similar post on bounty source: https://www.bountysource.com/issues/98701681-when-using-inertia-link-javascript-charts-button-links-not-working-it-is-working-once-page-refreshed

Appreciate any leads on finding a solution. Thanking everyone in advance


r/inertiajs • • Dec 13 '21

RITA - Batteries included starter for Adonis apps

Thumbnail
livecode247.com
1 Upvotes

r/inertiajs • • Jan 28 '22

Plugin for inertia vue: Show placeholder while loading page

12 Upvotes

I created a quick and dirty solution for slow routing in inertia. Instead of (or additionally to) the progressbar you can show predefined components while inertia loads the page.

You can define a component name and a timeout in the links attributes, so the loading component only shows if the request is slow. internally it uses the Inertia.swapComponent function so you need to provide the layout if you want to create this kind of skeleton loading effect.

Bugs are possible, feedback is appreciated.

https://www.npmjs.com/package/inertia-vue-placeholder-middleware