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

Refactoring List code to remove lots of internal state that caused some render issues #1961

Merged
merged 6 commits into from Feb 25, 2021

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Feb 15, 2021

I could not track down the issues directly, so imported Tree/Table style code to render with simpler code.

TODO:

  • Solve why some test are unstable...?

Fixes #1948, #1960

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@andydotxyz andydotxyz marked this pull request as ready for review February 21, 2021 15:47
Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple comments for possible code improvements. Apart from that, it seems to be working fine.

widget/list.go Show resolved Hide resolved
widget/list.go Outdated Show resolved Hide resolved
Jacalz
Jacalz previously approved these changes Feb 23, 2021
Copy link
Member

@Jacalz Jacalz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but probably good if someone more has a look as well.

widget/list.go Outdated
} else {
objects[len(objects)-1].Move(fyne.NewPos(0, 0))
func (l *listLayout) setupListItem(item fyne.CanvasObject, id ListItemID) {
li := item.(*listItem)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason to receive a fyne.CanvasObject instead of directly a *listItem? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, a hangover from old code - thanks

li.selected = false
for _, s := range l.list.selected {
if id == s {
li.selected = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is setting up a single list item, wouldn't it be more efficient to break the loop when the list item selected was found?

@andydotxyz andydotxyz merged commit b707f9b into fyne-io:develop Feb 25, 2021
@andydotxyz andydotxyz deleted the fix/1948 branch February 25, 2021 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants