Skip to content

Inertia.js v3 Beta: Reimagining the Modern Monolith with Built-in XHR and Optimistic UI

Published: Duration: 3:27
0:00 0:00

Transcript

Guest: Hey Alex! Thanks for having me. It’s a great time to be talking about Inertia. I feel like we’ve all been waiting for that "next big leap," and v3 is... well, it's definitely a leap. Host: It really is! I mean, let's jump right into the big one. The headline that made everyone do a double-take: Inertia is dropping Axios. When I saw that, I was like, "Wait, really?" Axios is basically the industry standard. Why move away from it now? Guest: (Laughs) Right? It was a bit of a "record scratch" moment for the community. But honestly, the more I’ve used the beta, the more it makes sense. Axios is fantastic, don't get me wrong, but it’s a general-purpose library. It’s built to do everything for everyone. Host: Oh, absolutely. Anything that makes the "Time to Interactive" faster is a win. But I have to ask—is this going to be a headache for people who have like, twenty different Axios interceptors for logging or custom auth? Guest: Yeah, I won’t sugarcoat it—that is the "migration hurdle." If you’ve heavily customized `axios.defaults`, you’re going to have to port that logic over to Inertia’s new internal configuration hooks. It’s a breaking change, for sure. But in my experience, once you get that logic moved, the deep integration with the Inertia lifecycle feels much... cleaner? It’s like the framework finally knows exactly what the request is doing at every stage. Host: That makes a lot of sense. It’s like moving from a "one size fits all" tool to a custom-tailored suit. Now, speaking of things feeling "cleaner," let’s talk about the "Optimistic UI" and "Instant Visits." This feels like the "holy grail" for making a monolith feel like a high-end SPA. How does it actually work in practice? Guest: This is probably my favorite part of v3. You know that tiny delay when you click "like" on a post, and you're waiting for the server to ping back so the heart icon fills in? Host: Ugh, yes. That "loading gap" is the only thing that screams "I'm a server-side app!" Guest: Exactly! Well, v3 introduces native Optimistic UI. It allows the interface to update instantly, *assuming* the request will succeed. If it fails, Inertia handles the rollback of that state for you. It’s "zero-latency" feel right out of the box. Host: That’s wild! I can see that being a total game-changer for e-commerce or dashboard apps where users expect that "instant" feedback. But okay, let's talk about the new `useHttp` hook. I saw the code snippet for this and it looks... different for Inertia. Usually, every request is a "visit," right? Guest: Exactly. Historically, if you wanted to update a single piece of data—like auto-saving a draft—without refreshing the whole page object, you had to do some weird gymnastics. You’d use `router.post` with `preserveState` or just give up and use a standard `fetch` call. Host: Oh, I love that. It’s like they realized we don’t always want to "travel" to a new page; sometimes we just want to grab a snack from the kitchen and stay on the couch! Guest: (Laughs) That is the perfect analogy. It’s exactly that. Host: So, for the developers listening who are itching to try this... it is still in beta. What’s the "vibe" on stability? Should we be putting this in production yet? Guest: Well, it’s a beta! I’ve been running it on some staging environments and it feels surprisingly solid, but I wouldn’t go live with a mission-critical banking app just yet. The team is really looking for feedback on the new XHR client across different browsers. Host: Great advice. Leo, this has been so enlightening. It really feels like Inertia is maturing into a complete engine rather than just a library. Before we go, where can people find you or follow your work? Guest: You can find me on X at @LeoVanceDev, or check out some of my Inertia experiments over on GitHub. I’m always down to chat about the "Modern Monolith"!