Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation error redirects to / #681

Open
harrisonratcliffe opened this issue Nov 7, 2024 · 1 comment
Open

Validation error redirects to / #681

harrisonratcliffe opened this issue Nov 7, 2024 · 1 comment

Comments

@harrisonratcliffe
Copy link

harrisonratcliffe commented Nov 7, 2024

Hi, I've got a simple form that is redirecting to / when there is validation errors rather than staying on the page and showing the errors. I am using ziggy but ziggy worked fine previously.

<form onSubmit={SubmitForm}>
post(route('contact.submit'));
import '../css/app.css';
import './bootstrap';

import { createInertiaApp } from '@inertiajs/react';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { createRoot, hydrateRoot } from 'react-dom/client';

import TimeAgo from 'javascript-time-ago';
import en from 'javascript-time-ago/locale/en';

TimeAgo.addDefaultLocale(en);
TimeAgo.addLocale(en);

const appName = import.meta.env.VITE_APP_NAME || 'Pretty URL';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => {
        const pages = import.meta.glob('./Pages/**/*.tsx');
        return resolvePageComponent(`./Pages/${name}.tsx`, pages);
    },
    setup({ el, App, props }) {
        if (import.meta.env.SSR) {
            hydrateRoot(el, <App {...props} />);
            return;
        }

        createRoot(el).render(<App {...props} />);
    },
    progress: {
        color: '#3b82f6',
    },
});

This previously worked fine but I'm unsure what's going on now? Happens on any page, any form. I've clearly messed something up somewhere but does anyone have any ideas what it could be?

@harrisonratcliffe
Copy link
Author

I just noticed I posted this on the wrong repo, but I fixed it.

Weirdly, <meta name="referrer" content="origin"> is the cause but I'm not sure why..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant