Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

resize_observer: Prevent loop using requestAnimationFrame.

userAdityaa196f4e92a3c4
diff --git a/web/src/compose_setup.js b/web/src/compose_setup.js
index e2fbe814234..0a133748629 100644
--- a/web/src/compose_setup.js
+++ b/web/src/compose_setup.js
@@ -108,7 +108,11 @@ export function initialize() {
// Updates compose max-height and scroll to bottom button position when
// there is a change in compose height like when a compose banner is displayed.
- const update_compose_max_height = new ResizeObserver(resize.reset_compose_message_max_height);
+ const update_compose_max_height = new ResizeObserver((_entries) => {
+ requestAnimationFrame(() => {
+ resize.reset_compose_message_max_height();
+ });
+ });
update_compose_max_height.observe(document.querySelector("#compose"));
function get_input_info(event) {