mirror of https://github.com/zulip/zulip.git
buddy list: Remove stale jank from find_li.
It's clearer to return undefined than an empty list, because it's easier to do an equality check for undefined at call sites to this function. `ListCursor.get_row` returns early for falsey values returned from `find_li`, so I think whatever this comment is referring to is no longer relevant.
This commit is contained in:
parent
be033394b1
commit
5db0f5f29a
|
@ -555,8 +555,10 @@ export class BuddyList extends BuddyListConf {
|
|||
if (pos < this.render_count) {
|
||||
this.render_count -= 1;
|
||||
const $li = this.find_li({key: opts.user_id});
|
||||
$li.remove();
|
||||
this.update_padding();
|
||||
if ($li !== undefined) {
|
||||
$li.remove();
|
||||
this.update_padding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -623,9 +625,7 @@ export class BuddyList extends BuddyListConf {
|
|||
const pos = this.all_user_ids.indexOf(user_id);
|
||||
|
||||
if (pos < 0) {
|
||||
// TODO: See ListCursor.get_row() for why this is
|
||||
// a bit janky now.
|
||||
return [];
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.force_render({
|
||||
|
@ -662,8 +662,10 @@ export class BuddyList extends BuddyListConf {
|
|||
if (new_pos_in_all_users < this.render_count) {
|
||||
this.render_count += 1;
|
||||
const $li = this.find_li({key: user_id_following_insertion});
|
||||
$li.before(html);
|
||||
this.update_padding();
|
||||
if ($li !== undefined) {
|
||||
$li.before(html);
|
||||
this.update_padding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue