@@ -83,6 +83,7 @@ var MetadataPlot = Panel.extend({
8383 this . plottableData = null ;
8484 if ( this . plottableDataPromise ) {
8585 this . plottableDataPromise . abort ( ) ;
86+ this . plottableDataPromise = null ;
8687 }
8788 const hasPlot = ( this . getPlotOptions ( ) . filter ( ( v ) => v . type === 'number' && v . count ) . length >= 2 ) ;
8889
@@ -162,17 +163,22 @@ var MetadataPlot = Panel.extend({
162163 if ( this . _currentAnnotations && this . _currentAnnotations . length >= 1 ) {
163164 keys = keys . concat ( [ '_3_annotation.id' , '_5_annotationelement.id' ] ) ;
164165 }
165- this . plottableDataPromise = restRequest ( {
166- url : `annotation/item/${ this . item . id } /plot/data` ,
167- method : 'POST' ,
168- error : null ,
169- data : {
170- adjacentItems : ! ! this . plotConfig . folder ,
171- keys : keys . join ( ',' ) ,
172- requiredKeys : requiredKeys . join ( ',' ) ,
173- annotations : JSON . stringify ( this . _currentAnnotations )
174- }
175- } ) . done ( ( result ) => {
166+ const fetch = {
167+ adjacentItems : ! ! this . plotConfig . folder ,
168+ keys : keys . join ( ',' ) ,
169+ requiredKeys : requiredKeys . join ( ',' ) ,
170+ annotations : JSON . stringify ( this . _currentAnnotations )
171+ } ;
172+ if ( ! this . plottableDataPromise || ! _ . isEqual ( this . _lastPlottableDataFetch , fetch ) ) {
173+ this . plottableDataPromise = restRequest ( {
174+ url : `annotation/item/${ this . item . id } /plot/data` ,
175+ method : 'POST' ,
176+ error : null ,
177+ data : fetch
178+ } ) ;
179+ }
180+ this . _lastPlottableDataFetch = fetch ;
181+ this . plottableDataPromise . done ( ( result ) => {
176182 this . plottableData = result ;
177183 } ) ;
178184 } ,
0 commit comments