iam also have same problem
409 Conflict with InertiaJS (React)
Hello everyone,
I'm relatively new to using InertiaJS and currently facing an issue with my Laravel endpoints returning a 409 Conflict error and triggering a page refresh. I have a function that calls a Laravel endpoint on a button click, and here's a snippet of the relevant code:
export default function CompanyInformation({ auth }) {
const { errors, data } = usePage().props;
const handleButtonClick = async (value) => {
await Inertia.get("/company-information/profile", {
symbol: value,
});
};
return (
// ... some parts of the component ...
{data && (
<CompanyProfile
details={data.company_profile}
/>
)}
// ... rest of the component ...
);
}
The corresponding controller function in Laravel looks like this:
public function getCompanyInformation(Request $request)
{
try {
// ... processing ...
$response = [
'company_profile' => $result
];
return Inertia::render('CompanyInformation', ['data' => $response]);
} catch (Exception $e) {
return Inertia::render('CompanyInformation', ['errors' => [
'exception' => $e->getMessage()
]]);
}
}
The behavior I'm observing is that the browser is forced to reload before displaying the correctly rendered page. I expected InertiaJS to render the CompanyProfile component without a page reload, similar to the behavior with api calls using axios and setting states. I'm uncertain if this is normal behavior with InertiaJS or if there's a potential issue. Any insights or guidance on this matter would be highly appreciated.
Thanks!
Please or to participate in this conversation.