remix-hook-form icon indicating copy to clipboard operation
remix-hook-form copied to clipboard

?index appended to form action

Open SirCameron opened this issue 1 year ago • 12 comments

If I don't specify a form action, the action is assumed to the current path + ?index, eg: /join?index, but the form submission works and the correct action is called.

If I do specify the form action as the current path, eg: /join, and submit, I get 405 Method Not Allowed..

What am I missing here?

SirCameron avatar Jan 24 '25 12:01 SirCameron

Same problem here, since react-router v7

MrGlox avatar Feb 01 '25 17:02 MrGlox

Same issue

tobimori avatar Feb 28 '25 00:02 tobimori

Had some solution by using fetcher instead, but even with redirection if we stay on page with errors from schema, it applies the "?index" part.

MrGlox avatar Feb 28 '25 21:02 MrGlox

Can anybody create a minimum repro for this so I can check out what's going on?

This sounds like a react-router thing as I use their hooks to submit to the correct path, I'm assuming if you used their hooks directly it would still submit to the ?index route? I think that differentiates betwee nsubmitting to /dashboard.tsx and /dashboard.index.tsx

AlemTuzlak avatar Apr 03 '25 15:04 AlemTuzlak

That's not minimum, but you can see at the signup page here: https://github.com/MrGlox/remix-nest-boilerplate

In any case the payload is submitted, in case of error and no redirection, we have the ?index added.

MrGlox avatar Apr 07 '25 08:04 MrGlox

@MrGlox mind just sending me the exact file instead of the whole boilerplate?

AlemTuzlak avatar Apr 07 '25 09:04 AlemTuzlak

Ah yes sry, https://github.com/MrGlox/remix-nest-boilerplate/blob/main/apps/web/app/routes/_auth%2B/signup.tsx but it is more visible in https://github.com/MrGlox/remix-nest-boilerplate/blob/main/apps/web/app/routes/_auth%2B/signin.tsx after a connection attempt. I'll try to make a minimum project !

MrGlox avatar Apr 07 '25 12:04 MrGlox

what happens if you update "@react-router/remix-config-routes-adapter" to the non-alpha version?

AlemTuzlak avatar Apr 07 '25 12:04 AlemTuzlak

I have this issue with using the standard RR7 routes config, just fyi.

tobimori avatar Apr 07 '25 13:04 tobimori

Here: https://github.com/MrGlox/remix-hook-form-example

MrGlox avatar Apr 07 '25 14:04 MrGlox

@MrGlox the repro has no relevant code, did you forget to commit?

AlemTuzlak avatar Jul 07 '25 11:07 AlemTuzlak

It has all you need with just pnpm i and pnpm dev, see current screen, reproduced with a new computer just now.

I remain available if needed!

Image

MrGlox avatar Jul 07 '25 13:07 MrGlox