settings: Fix flashing of information density setting inputs.

We change the code to update the visibility of information
density setting inputs only on successful completion of
request and not on receiving events.

Visibility of inputs is not being live updated on receiving
events because that leads to flashing of inputs when deselecting
the "Compact mode" checkbox due to the data being sent in
different events and data with the client being different for
time till the all events are received.
This commit is contained in:
Sahil Batra
2024-07-18 16:05:07 +05:30
committed by Tim Abbott
parent 59068c24e9
commit d8aedc1f8e
5 changed files with 57 additions and 35 deletions

View File

@@ -461,17 +461,6 @@ export function dispatch_normal_event(event) {
realm_user_settings_defaults,
);
}
if (
["dense_mode", "web_font_size_px", "web_line_height_percent"].includes(
event.property,
)
) {
/* istanbul ignore next */
settings_preferences.update_information_density_settings_visibility(
$(settings_realm_user_settings_defaults.realm_default_settings_panel.container),
);
}
break;
}
@@ -804,9 +793,6 @@ export function dispatch_normal_event(event) {
$("body").toggleClass("more-dense-mode");
information_density.set_base_typography_css_variables();
information_density.calculate_timestamp_widths();
settings_preferences.update_information_density_settings_visibility(
$(settings_preferences.user_settings_panel.container),
);
}
if (
event.property === "web_font_size_px" ||
@@ -814,9 +800,6 @@ export function dispatch_normal_event(event) {
) {
information_density.set_base_typography_css_variables();
information_density.calculate_timestamp_widths();
settings_preferences.update_information_density_settings_visibility(
$(settings_preferences.user_settings_panel.container),
);
}
if (event.property === "web_mark_read_on_scroll_policy") {
unread_ui.update_unread_banner();