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

Add auto-scroll to latest message #18

Merged
merged 6 commits into from
Feb 9, 2021
Merged

Add auto-scroll to latest message #18

merged 6 commits into from
Feb 9, 2021

Conversation

heruan
Copy link
Member

@heruan heruan commented Feb 8, 2021

Closes #4.

@heruan heruan self-assigned this Feb 8, 2021
@heruan heruan marked this pull request as ready for review February 8, 2021 13:10
@@ -59,7 +60,8 @@ class MessageListElement extends ElementMixin(ThemableMixin(PolymerElement)) {
type: Array,
value: function () {
return [];
}
},
observer: '_itemsChanged'
Copy link
Member

Choose a reason for hiding this comment

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

A single property observer only handles the cases when the whole array is reset: messageList.items = []
But it does not cover updating the items with Polymer magic methods, e.g. messageList.push('items', {}).

Please consider using a multi-property observer instead, see vaadin-menu-bar for an example.

One downside of multi-propery observers is that you will not get an old value though.

Copy link
Member Author

@heruan heruan Feb 9, 2021

Choose a reason for hiding this comment

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

Thanks @web-padawan for the suggestion: we discussed this and decided to observe only the replacement of the whole array (also considering the future transition to Lit).

@Peppe Peppe merged commit d8a17a8 into master Feb 9, 2021
@Peppe Peppe deleted the auto-scroll branch February 9, 2021 13: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.

vaadin-message-list auto-scrolling
3 participants