Keep client state alive with Inertia.js partial reloads
Update a subset of Inertia page props without remounting React components, so open dropdowns and unsaved input state survive navigation.
26 Feb 2026, 23:07 UTC

The problem: navigation that forgets your UI state
You open a filter dropdown, click inside a search box, then submit the form. The list updates, but the dropdown closes and the cursor jumps out of the input. In a traditional server-rendered app that is expected: the browser replaces the entire HTML document. In an Inertia.js app it does not have to happen.
Inertia lets server-rendered pages behave like a single-page application by sending JSON page props instead of full HTML. The useful takeaway is to use a partial reload with the only option. It refreshes just the props you name while keeping the client-side component mounted, so open menus, scroll position, and local input state survive the update.
What a partial reload actually does
On a normal Inertia visit, the client receives fresh page props and mounts a new component tree. A partial reload asks the server for only a subset of those props—for example, tasks and filters—and merges them into the current page. Because the React, Vue, or Svelte component is not torn down, client-only state that was never sent to the server stays where it is.
Version note: Inertia.js v1 and v2 differ in adapter imports and form helper APIs. The example below targets the common v1 React/Laravel pattern. Check your installed adapter before copying code between major versions.
Worked example: search without losing the dropdown
Assume a React component receiving tasks and filters as page props from a Laravel backend.
import { useForm, router } from '@inertiajs/react';
export default function TaskList({ tasks, filters }) {
const form = useForm({ search: '' });
const handleSubmit = (event) => {
event.preventDefault();
router.get('/tasks', {
data: form.data(),
only: ['tasks', 'filters'],
preserveScroll: true,
});
};
return (
form.setField('search', event.target.value)}
/>
Search
{tasks.map((task) => (
- {task.name}
))}
);
}
The only: ['tasks', 'filters'] option tells Inertia to replace those two props and leave everything else alone. If a user had a task row expanded or a date-picker open, that UI remains mounted because the component itself is not remounted.
Run npm list @inertiajs/react in your project root to confirm the adapter is installed. This is a read-only command and requires no special permissions. Expected output includes the package name and version; if it is missing, install the adapter that matches your server framework.
Verify it in DevTools
Open your browser's DevTools, go to the Network tab, and filter for fetch/XHR. Click the search button above. A normal page load returns HTML; an Inertia visit returns JSON and sends the X-Inertia: true header. For a partial reload, the JSON body should contain only the keys you listed in only, and the dropdown or input focus should not reset.
If the response is full HTML, the link or form is not being handled by Inertia. Check that you used router.get or an Inertia Link rather than a standard anchor or native form submission.
Limitations
- Partial reloads update props, but they do not re-run mount-only effects. If you copied a server prop into local state with an empty dependency array, that local copy can go stale after the prop changes.
- Shared props are sent on every visit. Putting large objects in shared props inflates every JSON payload, partial reloads included.
- A partial reload is usually a GET and changes no server state, so there is nothing to roll back. If you send a mutating POST, PUT, or PATCH, validate input first and let the server handle transactions.
Closing
Partial reloads are most useful when the server needs to send new data but the client should keep its UI. Check your adapter version, use only to name the props you want refreshed, and confirm the JSON response in DevTools. If you find yourself reloading the whole page just to refresh a list, only is likely the better tool.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.