From c317d0d5360eff121bfaaffb4c9b6fac546c6805 Mon Sep 17 00:00:00 2001 From: Patrick Steele-Idem Date: Fri, 6 Feb 2015 10:01:54 -0700 Subject: [PATCH] Handle case where a template was loaded before hot-reload was enabled --- hot-reload/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hot-reload/index.js b/hot-reload/index.js index c9698d970..8743fd079 100644 --- a/hot-reload/index.js +++ b/hot-reload/index.js @@ -28,9 +28,11 @@ exports.enable = function() { Template.prototype[k] = function() { if (this.__hotReloadModifiedFlag !== modifiedFlag) { var path = this.__hotReloadPath; - // Reload the template - var template = runtime.load(path); - extend(this, template); + if (path) { + // Reload the template + var template = runtime.load(path); + extend(this, template); + } } oldMethod.apply(this, arguments); @@ -41,7 +43,7 @@ exports.enable = function() { var oldLoad = runtime.load; - runtime.load = function browserRefreshLoad(path) { + runtime.load = function hotReloadLoad(path) { if (!path) { throw new Error('Invalid path'); }