Use double requestAnimationFrame to ensure DOM has fully reflowed before scrolling, and only scroll when log content actually changes.
Use double requestAnimationFrame to ensure DOM has fully reflowed before scrolling, and only scroll when log content actually changes.