skip to content

Links & Manual Visits

Inertia swaps pages through <Link> and router visits, keeping state and scroll when told, prefetching on hover and polling on a timer. Interviewers probe the 303 rule and cached stale data.

on this pageshow

explore

questions

6

Why does Inertia's Laravel adapter turn a 302 into a 303 after a PUT, PATCH or DELETE visit, and what breaks without it?

level: middleimportance: must knowfreq 48%

basics

~20 s

Inertia visits are XHRs, and a 302 after PUT, PATCH or DELETE is followed with the same method, so the redirect target receives a DELETE. The adapter rewrites 302 to 303 See Other, which the browser always follows with GET.

open as a page

An Inertia invoices table jumps to the top and clears its search box on each page change; which visit options fix this?

level: middleimportance: should knowfreq 44%

basics

~20 s

Inertia resets scroll and remounts the page component on each GET visit. preserveScroll keeps the scroll position, preserveState keeps local state such as the search input, replace avoids a history entry per page, and a scrollable container needs a scroll-region attribute.

open as a page

After logout, a user of a Laravel Inertia app presses Back and sees the previous account's invoices; how do encryptHistory and clearHistory prevent that?

level: seniorimportance: should knowfreq 24%

basics

~20 s

Inertia stores each page object in the browser's history state, so Back can show it without asking the server. Encrypting history and calling Inertia::clearHistory() on logout rotates the key, so old entries cannot be decrypted and Inertia fetches fresh data instead.

open as a page

With Inertia's <Link prefetch>, a user deletes an invoice and then sees it again on a prefetched list page; why, and how do cacheFor and cache tags fix it?

level: seniorimportance: should knowfreq 28%

basics

~20 s

Prefetched responses are cached, 30 seconds by default, and a click inside that window renders the cache without asking the server. Shorten cacheFor, or tag the link and invalidate the tag when the delete succeeds.

open as a page

An Inertia page refreshes a job-status table with usePoll every two seconds; how do its options, router.reload and router.cancelAll keep requests under control?

level: middleimportance: nice to knowfreq 18%

basics

~10 s

usePoll(2000, { only: ['jobs'] }) runs router.reload on each tick and stops on unmount. mode decides overlap, cancel or rest, background tabs are throttled unless keepAlive, and router.cancelAll() aborts in-flight requests.

open as a page