solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.11k stars 138 forks source link

actionRef.startsWith is not a function #357

Closed knpwrs closed 6 months ago

knpwrs commented 6 months ago

Describe the bug

In handleFormSubmit it appears that somehow evt.target.action is an HTMLButtonElement, rather than a string.

Your Example Website or App

https://gitlab.com/letschurch/lets.church/-/tree/web-solid-next/apps/web-solid-next?ref_type=heads

Steps to Reproduce the Bug or Issue

Using the action function as your action with method set to 'post' can somehow cause evt.target.action to be a button rather than a string, and the call to startsWith fails.

Expected behavior

Using the action function as action with method set to post should always work.

Screenshots or Videos

image image image

Platform

Additional context

I don't really know how this is happening. I would expect .action on an HTMLFormElement to always be a string (or undefined?) but it's a button. In this case, as you can see in the screenshot above, using .getAttribute returns the right value.

I have other forms that are working just fine, I don't know what's going on with this particular form.

knpwrs commented 6 months ago

Wait a minute, I recognize this bug. It happens when there is a field with name set to action. I feel like I submitted a PR to fix this in the older solid start but I couldn't find that PR.

knpwrs commented 6 months ago

In any case, #358 fixes it.

ryansolid commented 6 months ago

Hmm.. I think there was a reason I wanted to use the property because of the way it resolved path. But I understand the problem. Any fix will need to be tested thoroughly.