# 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.

- URL: https://laravel-vuejs.space/inertia-preserve-state-vue
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2026-10-11
- Topics: Laravel, VueJs, Inertia

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](https://laravel-vuejs.space/laravel-inertia-vue-crud) 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.

```ts
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:

```ts
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

**Q: 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.

**Q: 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.
