Skip to content

Commit 7dae408

Browse files
prevent initialization of charts twice (only in the library)
1 parent 8a39b26 commit 7dae408

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

js/render-facade.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@
8181
}
8282

8383
$(document).ready(function(){
84-
// facade loads twice in the admin area, so all charts are also loaded twice
84+
// facade loads twice in the library, so all charts are also loaded twice
8585
// this will ensure that even if it loaded twice, it initializes all charts only once.
8686
// fixed as part of the issue to add annotations.
87-
if(localStorage.getItem( 'viz-facade-loaded' ) === '1'){
88-
localStorage.removeItem( 'viz-facade-loaded' );
89-
return;
87+
if(visualizer.page_type === 'library'){
88+
if(localStorage.getItem( 'viz-facade-loaded' ) === '1'){
89+
localStorage.removeItem( 'viz-facade-loaded' );
90+
return;
91+
}
92+
localStorage.setItem( 'viz-facade-loaded', '1');
9093
}
91-
localStorage.setItem( 'viz-facade-loaded', '1');
9294
$('body').trigger('visualizer:render:chart:start', visualizer);
9395
initActionsButtons(visualizer);
9496
registerDefaultActions();

0 commit comments

Comments
 (0)