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

Multiple pending form submissions #16

Open
itsMapleLeaf opened this issue Sep 19, 2021 · 4 comments
Open

Multiple pending form submissions #16

itsMapleLeaf opened this issue Sep 19, 2021 · 4 comments
Labels
📦 feature New feature or request

Comments

@itsMapleLeaf
Copy link
Collaborator

I think one way we could support this would be to return an array from usePendingFormSubmit that has all of the states for the forms... that might be breaking. If that matters, we could make a new hook to return the array, then have the current one return the latest form, like it already does.

On another note, with the growing complexity of this, it might be worth looking into using RxJS, or some other implementation of streams/observables to handle this a little more nicely

@itsMapleLeaf itsMapleLeaf added the 📦 feature New feature or request label Sep 19, 2021
@smeijer
Copy link
Owner

smeijer commented Sep 19, 2021

Html form elements accept a name attribute. I was thinking to reuse that. When the user would call usePendingFormSubmit without arguments, it behaves like now. Provide an optional name argument, and it will return the state for the matching form.

An array as return value sounds nice, but then it would still be hard to match form and spinner. (what array index matches "this" form?)

@itsMapleLeaf
Copy link
Collaborator Author

Well, I actually don't need to match specific forms at the moment. My use case is to know how many things are currently being created, and how many things are currently being deleted, and having a list of pending submissions is sufficient for that.

But the idea you have is still good. Maybe the array form can just be a separate hook ¯\_(ツ)_/¯

@smeijer
Copy link
Owner

smeijer commented Sep 19, 2021

usePendingFormSubmissions?

@itsMapleLeaf
Copy link
Collaborator Author

Sure, that works 👍

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

No branches or pull requests

2 participants