From bfb599666e04ba53c8661368518588d54dd88668 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 4 Jul 2016 15:20:22 -0600 Subject: [PATCH] When an infolog changes, only refresh calendar when it's the active app, otherwise wait until it is activated. Fixes event positioning problems caused by refreshing while hidden without needing to recalculate everything while hidden. --- calendar/js/app.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/calendar/js/app.js b/calendar/js/app.js index c9e833f5fb..15a71160dc 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -304,9 +304,24 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend( } if (do_refresh) { - // Discard cache, reload + // Discard cache this._clear_cache(); - this.setState({state: this.state}); + + // Calendar is the current application, refresh now + if(framework.activeApp.appName == this.appName) + { + this.setState({state: this.state}); + } + // Bind once to trigger a refresh when tab is activated again + else if(framework.applications.calendar && framework.applications.calendar.tab && + framework.applications.calendar.tab.contentDiv) + { + jQuery(framework.applications.calendar.tab.contentDiv) + .off('show.calendar') + .one('show.calendar', + jQuery.proxy(function() {this.setState({state: this.state});},this) + ); + } } break; case 'calendar':