Project

General

Profile

Bug #35904

mgr/dashboard: ngOnChanges function is executing without any change on table component

Added by Kanika Murarka over 5 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Ricardo Marques
Category:
-
Target version:
-
% Done:

100%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

`ngOnChanges` function is triggered even when there is no change in selection (checked in `cd-table-key-value` component). Also, it triggers automatically after every particular interval.

History

#1 Updated by Volker Theile over 5 years ago

This can be easily fixed with


--- src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts    (date 1536569186000)
+++ src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts    (date 1536578794000)
@@ -384,8 +384,8 @@

   /**
    * After updating the data, we have to update the selected items
-   * because details may have changed,
-   * or some selected items may have been removed.
+   * because details may have changed, or some selected items may
+   * have been removed.
    */
   updateSelected() {
     const newSelected = [];
@@ -396,8 +396,12 @@
         }
       }
     });
-    this.selection.selected = newSelected;
-    this.onSelect();
+    if (!_.isEqual(this.selection.selected, newSelected)) {
+      this.selection.selected = newSelected;
+      this.onSelect();
+    }
   }

   onSelect() {

!!! Attention !!!
Applying this code will prevent the updating of the details pages as they are implemented right at the moment, so we will have a regression here. Keep in mind that the data of the selected object might have changed in the meanwhile. Because of this behaviour the 'updateSelected' method is implemented that way to allow our details pages to get notified of data changes and to redraw the information. Currently i do not have any idea how to workaround this.

#2 Updated by Ricardo Marques over 5 years ago

  • Status changed from New to In Progress

#3 Updated by Ricardo Marques over 5 years ago

  • Subject changed from mgr/dashboard: ngOnChanges function is executing without any change to mgr/dashboard: ngOnChanges function is executing without any change on table component

#4 Updated by Ricardo Marques over 5 years ago

  • Status changed from In Progress to Fix Under Review

#5 Updated by Patrick Seidensal over 5 years ago

  • Status changed from Fix Under Review to Resolved
  • % Done changed from 0 to 100

#6 Updated by Ernesto Puerta almost 3 years ago

  • Project changed from mgr to Dashboard

Also available in: Atom PDF