preserveState keeps the Vue page you have

preserveState leaves the current component in place. Validation errors stick around if you force it on after a save.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/inertia-preserve-state-vue.md
preserveState leaves the current component in place. Validation errors stick around if you force it on after a save.
Do not set preserveState: true on a logout request.
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Inertia preserveState” flip the flag on and then a successful save still shows the old error. Inertia already preserves state when validation fails. Forcing it on every response keeps the error after the save too.

TL;DR

  • preserveState leaves the current component in place.
  • Validation errors stick around if you force it on after a save.
  • Do not set preserveState: true on a logout request.

Who it's for: Laravel + Vue developers on Inertia

Applies to: Laravel 13 · Inertia 3 · Vue 3

The fix#

The form in the CRUD guide can stay on the default. Use the callback when a filter form must keep what the user typed and also drop errors after a clean save.

typescript
form.get("/posts", {
  preserveState: true,
  preserveScroll: true,
});

A GET filter should preserve state. The list refreshes, the input keeps the word. A POST that stays on the page is the careful one:

typescript
form.post("/comments", {
  preserveScroll: true,
  preserveState: (page) => Object.keys(page.props.errors).length > 0,
});

The callback keeps the component only when the new page still has errors. A clean response replaces local form state, which is what you want after a save.

What to avoid#

Gotcha

Do not set preserveState: true on a logout request. The old page’s props, including the user, stay on screen until something else navigates.

FAQ#

What does preserveState do in Inertia?

preserveState leaves the current component in place. Validation errors stick around if you force it on after a save.

What goes wrong with Inertia preserveState?

Many developers flip the flag on and then a successful save still shows the old error. Do not set preserveState: true on a logout request.

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.