mirror of https://github.com/zulip/zulip.git
minor: Avoid dict lookup for color.
The only thing get_color() does is look up a sub: exports.get_color = function (stream_name) { const sub = exports.get_sub(stream_name); if (sub === undefined) { return stream_color.default_color; } return sub.color; }; So if we have a sub already, there's no point calling the helper. Obviously, this isn't a huge deal, but it happens N times during page load.
This commit is contained in:
parent
0711c7ea49
commit
b3b83f223d
|
@ -216,7 +216,7 @@ function build_stream_sidebar_li(sub) {
|
|||
is_muted: stream_data.is_muted(sub.stream_id) === true,
|
||||
invite_only: sub.invite_only,
|
||||
is_web_public: sub.is_web_public,
|
||||
color: stream_data.get_color(name),
|
||||
color: sub.color,
|
||||
pin_to_top: sub.pin_to_top,
|
||||
};
|
||||
args.dark_background = stream_color.get_color_class(args.color);
|
||||
|
|
Loading…
Reference in New Issue