theme: Change recipient bar color and theme in the same paint.

`update_recipient_bar_background_color` changes in a paint
after change in theme without using `requestAnimationFrame` to
make sure they happen in the same paint..

Replaced `setTimeout` with `requestAnimationFrame` in
`server_events_dispatch` since `requestAnimationFrame` already
ensures that they happen in the next paint, assuming that was the
intention of `setTimeout` being preset there.
This commit is contained in:
Aman Agrawal
2023-07-02 12:36:30 +00:00
committed by Tim Abbott
parent 1c8bf4f050
commit d547b838ac
4 changed files with 19 additions and 11 deletions

View File

@@ -746,7 +746,7 @@ export function dispatch_normal_event(event) {
unread_ui.update_unread_banner();
}
if (event.property === "color_scheme") {
setTimeout(() => {
requestAnimationFrame(() => {
if (event.value === settings_config.color_scheme_values.night.code) {
dark_theme.enable();
realm_logo.render();
@@ -758,7 +758,7 @@ export function dispatch_normal_event(event) {
realm_logo.render();
}
message_lists.update_recipient_bar_background_color();
}, 300);
});
}
if (event.property === "starred_message_counts") {
starred_messages_ui.rerender_ui();