public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit] panel/JournalView: fix flickering in journal livemode
Date: Tue, 22 Jun 2021 11:57:25 +0200	[thread overview]
Message-ID: <20210622095725.27282-1-d.csapak@proxmox.com> (raw)

it seems that something changed in extjs 7 which does not quite
restore the correct scroll position when the identical content is set
on a component. this means that sometimes, we update the text
with the identical one, but the scroll position is now off, only
to scroll back to the bottom

this causes a flickering everytime we do the api call.

instead, only update the component when the content really changed.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/panel/JournalView.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/panel/JournalView.js b/src/panel/JournalView.js
index 692f241..f672be1 100644
--- a/src/panel/JournalView.js
+++ b/src/panel/JournalView.js
@@ -77,6 +77,8 @@ Ext.define('Proxmox.panel.JournalView', {
 	    let num = lines.length;
 	    let text = lines.map(Ext.htmlEncode).join('<br>');
 
+	    let contentChanged = true;
+
 	    if (!livemode) {
 		if (num) {
 		    view.content = text;
@@ -89,6 +91,8 @@ Ext.define('Proxmox.panel.JournalView', {
 		    view.content = view.content ? text + '<br>' + view.content : text;
 		} else if (!top && num) {
 		    view.content = view.content ? view.content + '<br>' + text : text;
+		} else {
+		    contentChanged = false;
 		}
 
 		// update cursors
@@ -101,7 +105,9 @@ Ext.define('Proxmox.panel.JournalView', {
 		}
 	    }
 
-	    contentEl.update(view.content);
+	    if (contentChanged) {
+		contentEl.update(view.content);
+	    }
 
 	    me.updateScroll(livemode, num, scrollPos, scrollPosTop);
 	},
-- 
2.20.1





             reply	other threads:[~2021-06-22  9:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  9:57 Dominik Csapak [this message]
2021-06-22 12:11 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622095725.27282-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal