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

Fix: roomlist reordering lags #2612

Merged
merged 8 commits into from
Feb 13, 2019
Merged

Fix: roomlist reordering lags #2612

merged 8 commits into from
Feb 13, 2019

Conversation

bwindels
Copy link
Contributor

@bwindels bwindels commented Feb 11, 2019

element-hq/element-web#8184

Also fixes/helps with element-hq/element-web#8186 as it's confusing to have the badge appear without it appearing as unread at exactly the same time.

Also replaced ratelimitedfunc in an attempt to make sure there was no bug there.
Replacing it with lodash code seems like a good thing in general though. And while at it,the search box seems to work better with debounce (doesn't run at all while still being triggered) behaviour than throttle (run every x while being triggered).

@bwindels bwindels requested review from a team and turt2live February 11, 2019 16:17
Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

otherwise lgtm

@@ -21,7 +21,7 @@ import { _t } from '../../languageHandler';
import { KeyCode } from '../../Keyboard';
import sdk from '../../index';
import dis from '../../dispatcher';
import rate_limited_func from '../../ratelimitedfunc';
import { debounce } from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

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

I thought throttle closer matched what we had? Or is there a reason to prefer the different behaviour (I think thge difference being whether it keep executing the thing every n seconds on sustained activity).

Copy link
Member

Choose a reason for hiding this comment

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

From reading the documentation, debounce seems like the thing we want here with the trailing edge later defined. If someone were to roll their face on the keyboard, we probably want to debounce that rather than rate limit it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, what Travis said. Feels faster in practice as well, as the delay can be smaller.

clearTimeout(self.scheduledCall);
self.scheduledCall = undefined;
}
import { throttle } from "lodash";
Copy link
Member

Choose a reason for hiding this comment

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

oh, it's throttle here - is there a reason to use different ones in different places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the behaviour we had in place here was the same as throttle, so I preserved that.
For a search field, debounce is usually better as you run the search code less and you can have a smaller delay.

Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

generally lgtm from a feature perspective - have not checked code quality, but it looks reasonable from a skim read

src/Unread.js Show resolved Hide resolved
src/components/structures/SearchBox.js Show resolved Hide resolved
@@ -21,7 +21,7 @@ import { _t } from '../../languageHandler';
import { KeyCode } from '../../Keyboard';
import sdk from '../../index';
import dis from '../../dispatcher';
import rate_limited_func from '../../ratelimitedfunc';
import { debounce } from 'lodash';
Copy link
Member

Choose a reason for hiding this comment

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

From reading the documentation, debounce seems like the thing we want here with the trailing edge later defined. If someone were to roll their face on the keyboard, we probably want to debounce that rather than rate limit it.

@bwindels bwindels assigned turt2live and unassigned bwindels Feb 12, 2019
@turt2live turt2live assigned bwindels and unassigned turt2live Feb 12, 2019
@bwindels bwindels merged commit 240dc3c into develop Feb 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants