public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time
Date: Mon, 18 Jul 2016 13:04:34 +0530
Message-ID: <CAM5-9D880YxpQeQj7V1uWAP_bg8GNJiQ9vQf=fm0EziiCSW+rw@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi

Please find attached patch for the fix:
*Issue:*
This issue is regression of one of the flickering issue of RM#1242.
"Aside from displaying/hiding the spinner, panes should have their content
refreshed until and unless the new data differs from the previous, to
reduce flicker"

*Solution:*
Along with caching the node node, we should also keep track of the previous
node clicked.
Fetch new data iff previous node and current node clicked differs.

Please review.

Thanks,
Surinder Kumar


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM#1462.patch (4.0K, 3-RM%231462.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/templates/browser/js/collection.js b/web/pgadmin/browser/templates/browser/js/collection.js
index 771cc07..9603ed0 100644
--- a/web/pgadmin/browser/templates/browser/js/collection.js
+++ b/web/pgadmin/browser/templates/browser/js/collection.js
@@ -103,12 +103,14 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
           n_value = treeHierarchy[n_type]._id;
         }

-        if (n_value == $(panel).data(n_type)) {
+        if (n_value == $(panel).data(n_type) &&
+            n_type == $(panel).data('uniq_id')) {
           return;
         }

         // Cache the current IDs for next time
         $(panel).data(n_type, n_value);
+        $(panel).data('uniq_id', n_type);

         // Reset the data object
         j.data('obj-view', null);
diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js
index e5a96c4..38c7116 100644
--- a/web/pgadmin/browser/templates/browser/js/node.js
+++ b/web/pgadmin/browser/templates/browser/js/node.js
@@ -804,12 +804,14 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
             n_value = treeHierarchy[n_type]._id;
           }

-          if (n_value == $(panel).data(n_type)) {
+          if (n_value == $(panel).data(n_type) &&
+              n_type == $(panel).data('uniq_id')) {
             return;
           }

           // Cache the current IDs for next time
           $(panel).data(n_type, n_value);
+          $(panel).data('uniq_id', n_type);

           if (!content.hasClass('has-pg-prop-btn-group'))
             content.addClass('has-pg-prop-btn-group');
diff --git a/web/pgadmin/misc/depends/static/js/depends.js b/web/pgadmin/misc/depends/static/js/depends.js
index 6883aa3..a72cf89 100644
--- a/web/pgadmin/misc/depends/static/js/depends.js
+++ b/web/pgadmin/misc/depends/static/js/depends.js
@@ -192,12 +192,14 @@ define(
         n_value = treeHierarchy[n_type]._id;
       }

-      if (n_value == $(panel[0]).data(n_type)) {
+      if (n_value == $(panel[0]).data(n_type) &&
+          n_type == $(panel).data('uniq_id')) {
         return;
       }

       // Cache the current IDs for next time
       $(panel[0]).data(n_type, n_value);
+      $(panel).data('uniq_id', n_type);


       // Hide the grid container and show the default message container
diff --git a/web/pgadmin/misc/sql/static/js/sql.js b/web/pgadmin/misc/sql/static/js/sql.js
index 9c06c65..56b1673 100644
--- a/web/pgadmin/misc/sql/static/js/sql.js
+++ b/web/pgadmin/misc/sql/static/js/sql.js
@@ -74,12 +74,14 @@ function(_, $, pgBrowser) {
                   n_value = treeHierarchy[n_type]._id;
               }

-              if (n_value == $(sqlPanels[0]).data(n_type)) {
+              if (n_value == $(sqlPanels[0]).data(n_type) &&
+                  n_type == $(sqlPanels).data('uniq_id')) {
                 return;
               }

               // Cache the current IDs for next time
-              $(this.sqlPanels[0]).data(n_type, n_value);
+              $(sqlPanels[0]).data(n_type, n_value);
+              $(sqlPanels).data('uniq_id', n_type);

               sql = '';
               var url = node.generate_url(item, 'sql', data, true);
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index f1217ae..87a0c23 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -166,12 +166,14 @@ function(_, $, pgBrowser, Backgrid) {
             n_value = treeHierarchy[n_type]._id;
           }

-          if (n_value == $(this.panel[0]).data(n_type)) {
+          if (n_value == $(this.panel[0]).data(n_type) &&
+              n_type == $(panel).data('uniq_id')) {
             return;
           }

           // Cache the current IDs for next time
           $(this.panel[0]).data(n_type, n_value);
+          $(panel).data('uniq_id', n_type);

           /* Set the message because ajax request may take time to
            * fetch the information from the server.


view thread (2+ messages)  latest in thread

reply

Reply instructions:

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

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time
  In-Reply-To: <CAM5-9D880YxpQeQj7V1uWAP_bg8GNJiQ9vQf=fm0EziiCSW+rw@mail.gmail.com>

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

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox