-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
[ Feat ]: Pass a pre-read FormData object via context. #60
Conversation
Hello @themkvz. We used to have an example on how to handle errors with Can you please provide more details of your case and how the Pull Request will affect the library? Two more things:
Thoughts on this issue @mw10013? |
@themkvz: Thank you for the PR. I wonder if Request.clone() may be helpful for your use case (https://developer.mozilla.org/en-US/docs/Web/API/Request/clone). Please share your thoughts. It is curious to see logic in the action of your login route that may redirect to an |
Thank you for your response! @dev-xo I will revert @mw10013 I use multiple forms on a single remix page following the next way https://sergiodxa.com/articles/multiple-forms-per-route-in-remix (using hidden input with |
@themkvz: Thanks for providing more color on your use case. It is helpful and compelling. Can you add a test for this? Also, a small section at the end of |
Any news on this @themkvz? Otherwise I think we can close it for now, and get back to it later at some point. |
I have already added two simple tests and I plan to add a short section with an explanation in the docs |
Thanks @themkvz, happy to know this is still active. Take your time and let us know when we can review it.
|
@dev-xo I've added the brief description to the About test: |
To be clear @themkvz, your current issue (and PR) could be solved by cloning the request like
Also, these changes will now imply that passing a pre-read FormData to the authenticate method will be required, right? |
It's an additional option Because in the Remix docs, for example, here we have an example of how to use The user has two options (if he has this specific case with more than one strategy on the same page and needs validate some form fields before passing the request):
If you need to validate FormData, yes – it will be required I opened this PR because I saw the section on how of works with a pre-read FormData in another remix-auth strategy, that's all) |
All good @themkvz. I was wondering if we could simply document this in the docs, letting users know that if they are looking to handle multiple auth strategies or validate the form, they could simply clone the Ideally, the simpler we keep the strategy, the fewer bugs we could introduce, and the easier it will be to maintain it.
I appreciate the efforts in improving the strategy and making it simpler for everyone else to handle this situation or similar ones, so thank you! |
Yeah, sure, it will be maybe the best way to post this possibility in the docs |
@themkvz: Thanks for the additions. We'd like to proceed with this. I ran ! [remote rejected] HEAD -> themkvz/main (permission denied)
error: failed to push some refs to 'https://github.com/themkvz/remix-auth-totp.git' Can you grant me permission? Thanks. |
Reverted it back, as it was not squashed and the whole history commit was cluttered with small unnecessary commits.
Otherwise, I will open a PR myself with the updated changes and push it. |
When I try to read FormData (for validation or something else) in action I get an error
FetchError: Invalid response body while trying to fetch http://localhost:5173/login: Invalid state: ReadableStream is locked
login.tsx
As a solution, I added simple checking if we have already passed formData via options