Remember a Vue filter with useRemember

useRemember keeps a filter in the history entry. It is the wrong place for a password or a draft you must not lose.

For your AI agent

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

Read https://laravel-vuejs.space/inertia-use-remember-vue.md
useRemember keeps a filter in the history entry. It is the wrong place for a password or a draft you must not lose.
Do not remember a password, a token, or a card number.
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Inertia useRemember” want a search box to keep its text when they open a post and press Back. The list itself should still come from Laravel. The pagination guide owns the links. This page is the local text.

TL;DR

  • useRemember keeps a filter in the history entry.
  • It is the wrong place for a password or a draft you must not lose.
  • Do not remember a password, a token, or a card number.

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

Applies to: Laravel 13 · Inertia 3 · Vue 3

The fix#

vue
<script setup lang="ts">
import { useRemember } from "@inertiajs/vue3";

const filters = useRemember({ search: "" });
</script>

<template>
  <input v-model="filters.search" name="search" />
</template>

useRemember writes the object into the history state for this visit. Back restores it. A full reload does not. If the search must survive a reload, put search in the query string and read it from a prop.

What to avoid#

Gotcha

Do not remember a password, a token, or a card number. History state is not a vault, and the back button shows it again. A draft that must survive leaving the page belongs in Pinia only if you accept that a reload still clears it. The server is the place for a draft you cannot lose.

FAQ#

How do I remember a Vue filter with useRemember?

useRemember keeps a filter in the history entry. It is the wrong place for a password or a draft you must not lose.

What goes wrong with Inertia useRemember?

Many developers want a search box to keep its text when they open a post and press Back. Do not remember a password, a token, or a card number.

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.