mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
resize_observer: Prevent loop using requestAnimationFrame.
This commit solves the issue where the ResizeObserver loop completes with undelivered notifications. By using requestAnimationFrame, the resize event is deferred until after the paint cycle, preventing an infinite loop caused by consecutive resize triggers before repaint.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user