Hi! I've stumbled upon a very specific error when an Inertia page is served from the browser cache:
First, HTML page is accessed, response is cached
Then, a partial reload on the same URL, expecting a Inertia JSON response (with X-Inertia header)
Inertia gets served first HTML, errors and shows response inside a modal
Taking a look at the InertiaRails::Renderer, it seems that the Vary header that would prevent this from happening is only added for subsequent X-Inertia Inertia responses – and so the browser still uses the first response for all cache hits.
I'm testing a monkey-patch fix on my app and could open a PR if this is the correct diagnosis.
Hi! I've stumbled upon a very specific error when an Inertia page is served from the browser cache:
X-Inertia
header)Taking a look at the
InertiaRails::Renderer
, it seems that theVary
header that would prevent this from happening is only added for subsequentX-Inertia
Inertia responses – and so the browser still uses the first response for all cache hits.I'm testing a monkey-patch fix on my app and could open a PR if this is the correct diagnosis.