-
Notifications
You must be signed in to change notification settings - Fork 6
Forms
Consume new attachments api
#434
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
Forms
Consume new attachments api
#434
Conversation
…rename-attachments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question. Looks good, but I don't understand why the add operation is done differently than the delete and rename operation.
// scroll to the new attachment after a delay to allow the recomposition to complete | ||
delay(100) | ||
lazyListState.scrollToItem(attachments.count()) | ||
formElement.addAttachment(name, contentType, data).onSuccess { formAttachment -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the addition to the state list done here and not in response to the added change event like rename and delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sorenoid fixed!
Summary of changes
attachmentChanged
event to handle deletion and renaming of attachments.AttachmentElementState.attachments
from aMap
to aList
. This is because theMap
does not preserve insertion order without an additional overhead. Using a list preserves the insertion order but increases the time complexity for deletion and rename to O(n).AttachmentElementState.Saver
does to store load statuses of itsFormAttachmentState
. Instead, this can be inferred by looking at theFormAttachment
objects when building the state list.FormAttachmentState
specifies a smaller size for the thumbnail to save on memory, which increased the UI responsiveness quite a bit.