Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

feat(iron-autogrow-textarea.html): add debounce function #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

felixzapata
Copy link

@felixzapata felixzapata commented Mar 21, 2018

This fixes #116, adding a debounce function to avoid the delay to the user.

@notwaldorf
Copy link
Contributor

I don't think this is good, since it basically delays everything by half a second. In particular, this also breaks all the tests, which means it breaks the tests of anybody who's ever written a test for using this element in their app.

this.$.mirror.innerHTML = this._valueForMirror();
this.debounce('delayMirror', function() {
this.$.mirror.innerHTML = this._valueForMirror();
}.bind(this), 500);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use no wait at all?

Copy link
Author

Choose a reason for hiding this comment

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

I can try without the wait, to see if it works.

Copy link
Author

Choose a reason for hiding this comment

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

It does not work without the wait. I've obtain similar results that without the debounce function.

captura de pantalla 2018-03-29 a las 9 44 20

captura de pantalla 2018-03-29 a las 9 33 27

I've also tested different values of waiting, but with 500 I've obtain better results and the delay on typing desappear:

captura de pantalla 2018-03-29 a las 9 45 42

My scenery is like a chat (made with components): a user enters in a room from a list on the left, and starts typing messages. The most number of rooms you have on the left, the greater delay you feel.

In my case, the bottleneck is this line:

this.$.mirror.innerHTML = this._valueForMirror();

Maybe this line can be made in a different way and so the debounce would not be necessary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance problem with many elements in the page
3 participants