-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Wayfinder Version
v0.1.12
Laravel Version
12.28.1
PHP Version
8.4.8
Description
When using Wayfinder in combination with Inertia + React, the generated URL from a controller action contains a double slash and repeats the protocol. This breaks form submissions because the resulting request URL is invalid.
Additional context:
- Local dev served via Laravel Valet
- Snippet from my
.envfile:
APP_URL=https://application.test/
Steps To Reproduce
- Create a controller action and reference it through Wayfinder in a React component.
- Example code:
import AccessCodeController from '@/actions/App/Http/Controllers/AccessCodeController';
console.log(AccessCodeController.submitForm());- Observe the output:
{
"url": "//https://application.test/access-code",
"method": "post"
}- Use this result in an Inertia form submission, e.g.:
import { useForm } from '@inertiajs/react';
const { submit } = useForm({ code: '' })
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
submit(AccessCodeController.submitForm());
};- Check the console/network tab, the request fails with:
POST https://https//application.test/access-code net::ERR_NAME_NOT_RESOLVED
Expected Behavior:
The generated URL should be a valid absolute URL without duplicated slashes or protocol repetition, e.g.:
{
"url": "https://application.test/access-code",
"method": "post"
}
Metadata
Metadata
Assignees
Labels
No labels