@@ -54,7 +54,9 @@ class NodeTable extends UNISYS.Component {
54
54
sortkey : 'label'
55
55
} ;
56
56
57
- this . onButtonClick = this . onButtonClick . bind ( this ) ;
57
+ this . handleDataUpdate = this . handleDataUpdate . bind ( this ) ;
58
+ this . OnTemplateUpdate = this . OnTemplateUpdate . bind ( this ) ;
59
+ this . onButtonClick = this . onButtonClick . bind ( this ) ;
58
60
this . onToggleExpanded = this . onToggleExpanded . bind ( this ) ;
59
61
this . setSortKey = this . setSortKey . bind ( this ) ;
60
62
this . sortSymbol = this . sortSymbol . bind ( this ) ;
@@ -66,14 +68,10 @@ class NodeTable extends UNISYS.Component {
66
68
67
69
// Always make sure class methods are bind()'d before using them
68
70
// as a handler, otherwise object context is lost
69
- this . OnAppStateChange ( 'D3DATA' , ( data ) => {
70
- this . handleDataUpdate ( data ) ;
71
- } ) ;
71
+ this . OnAppStateChange ( 'D3DATA' , this . handleDataUpdate ) ;
72
72
73
73
// Handle Template updates
74
- this . OnAppStateChange ( 'TEMPLATE' , ( data ) => {
75
- this . setState ( { nodePrompts : data . nodePrompts } ) ;
76
- } ) ;
74
+ this . OnAppStateChange ( 'TEMPLATE' , this . OnTemplateUpdate ) ;
77
75
} // constructor
78
76
79
77
@@ -99,6 +97,9 @@ handleDataUpdate(data) {
99
97
} ) ;
100
98
}
101
99
}
100
+ /// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101
+ OnTemplateUpdate ( data ) {
102
+ this . setState ( { nodePrompts : data . nodePrompts } ) ;
102
103
}
103
104
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
104
105
/*/ Build table of counts
@@ -363,6 +364,11 @@ render() {
363
364
this . handleDataUpdate ( D3DATA ) ;
364
365
}
365
366
367
+ componentWillUnmount ( ) {
368
+ this . AppStateChangeOff ( 'D3DATA' , this . handleDataUpdate ) ;
369
+ this . AppStateChangeOff ( 'TEMPLATE' , this . OnTemplateUpdate ) ;
370
+ }
371
+
366
372
displayUpdated ( nodeEdge )
367
373
{
368
374
var d = new Date ( nodeEdge . meta . revision > 0 ? nodeEdge . meta . updated : nodeEdge . meta . created ) ;
0 commit comments