-
Notifications
You must be signed in to change notification settings - Fork 117
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/update at index #548
Feat/update at index #548
Conversation
I haven't look into the detail yet. But the update intent should work anywhere, you can point it to the list and update the whole list or point it to a specific index and update the value just like any other field. |
From what I saw, it accepts a list of values. If I try to update a specific index, the field doesn't exist yet. Example
|
This works, but it's meh :D
|
How about making form.update({
name: fields.attachments.name,
index: someDeterminedIndex,
value: {
// data
},
}); |
Absolutely, that could work. However the update logic is much more complex and I'm not sure I'd do it correctly |
Here you go: #555 |
Hey, thank you 🙏🙏 Sorry, haven't had time to try out, will tomorrow |
It's all good :) You can try it out on v1.1.0-pre.0 now. |
@edmundhung Works flawlessly 😍 Thank you for everything :) |
Hey @edmundhung. I am in need to update a list item at a specific index so I tried to implement it. I welcome any suggestions. There's no contribution guide so I tried to scrap the code and came up with this :D
Use case:
I have a list of attachments in a community post. When a user wants to upload a file, I want to immediately insert it into a list with a loading state and when the upload is finished, I want to update the url and state at a specified index.
For now I have done it using remove and insert which works but is suboptimal.