-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Reduce updateItem calls #4012
Reduce updateItem calls #4012
Conversation
Thanks for looking at this. However every item must also update if Refresh is call. I think that was missed or not tested in the unit test you added. |
Changes made and tests passed (locally atleast. waiting on PR checks). It's not where I want it to be performance wise. Still getting less calls (description updated) but would ideally like it only to call updateItem 1x when it becomes visible. Still looking. |
Looks like it's working as desired and all green. |
9629181
to
7484dd9
Compare
Reworked to adhere to the current flow with minimal changes. |
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.
Thanks. That does look better. I didn't have time to test the code locally but I added some comments inline.
Co-authored-by: Jacob Alzén <[email protected]>
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.
Looks like a great improvement, thanks for helping with this.
I guess we need to match RefreshItem
with table and tree equivalents too, but that could be a follow up PR.
Thanks for guiding me through my first PR here. Hopefully more to come. |
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.
Thanks for the PR. This looks good to me as well. Congratulations on landing your first contribution to Fyne. We appreciate your work. Don't hesitate to reach out if you have any questions or want to discuss anything. A lot of discussions around Fyne take place in the #fyne and #fyne-contributors channels on Gophers Slack if you wish to join :)
Description:
Currently, placing a print in the
updateItem
callback for a list shows that the function is being called for all items that are visible for every change made. This makes expensive tasks repeat whenever there is any sort of change to the list, and locks up the screen for a long time. This change aims to only call the function for a given item only once, when the item becomes visible.The unit test shows a slight difference, however placing a print statement in the updateItem function seems to show a drastically more apparent change, as show below.
also, Fixes
#3826 (partially - for lists only)
Print out of list IDs - on loading of a list
currently
with the change
Print out of list IDs - scrolling down 2 items
current
with changes
Checklist: