The issue is likely related to the x-inertia-partial-component header not being sent. This header is required for the router.reload method to work correctly.
You can try adding the x-inertia-partial-component header manually to the headers object when calling router.reload:
const inertiaPage = usePage();
<button onClick={() => router.reload(
{
only: ['testLazy'],
headers: {
"x-inertia-partial-component": inertiaPage.component, // add this header
"x-test": "x-test2",
"version": inertiaPage.version || "not-found",
"component": inertiaPage.component
}
}
)}>Reload test</button>
If that doesn't work, you can try using the Inertia.visit method instead of router.reload. This method will send the x-inertia-partial-component header automatically.
Inertia.visit(window.location.pathname, {
only: ['testLazy']
});