From a0e92ef57ab2943fddfbf6bcc5e2301bf7afc512 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 5 Nov 2014 15:15:58 -0500 Subject: [PATCH] FIX: PageTracker was not sending the proper page title through at all times. --- app/assets/javascripts/discourse/lib/page_tracker.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/page_tracker.js b/app/assets/javascripts/discourse/lib/page_tracker.js index b94b5ab81ed..842f2d9b11d 100644 --- a/app/assets/javascripts/discourse/lib/page_tracker.js +++ b/app/assets/javascripts/discourse/lib/page_tracker.js @@ -19,7 +19,13 @@ Discourse.PageTracker = Ember.Object.extend(Ember.Evented, { router.on('didTransition', function() { this.send('refreshTitle'); - self.trigger('change', this.get('url'), Discourse.get('_docTitle')); + var url = this.get('url'); + + // Refreshing the title is debounced, so we need to trigger this in the + // next runloop to have the correct title. + Em.run.next(function() { + self.trigger('change', url, Discourse.get('_docTitle')); + }); }); this.set('started', true); }