From d91f20554f544a8f19c9240bd1a6c74cd13748db Mon Sep 17 00:00:00 2001 From: Brian Heithaus Date: Tue, 26 Nov 2013 17:35:47 -0800 Subject: [PATCH] bug fix for Issue #85 - request.isForPageLoad having issue while coming back to original server rendered url --- lib/davis.request.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/davis.request.js b/lib/davis.request.js index a5f864b..bbf2091 100644 --- a/lib/davis.request.js +++ b/lib/davis.request.js @@ -5,6 +5,12 @@ */ Davis.Request = (function () { + /*! + * keep track of the first page load that Davis handles, this will be used to determine + * request.isForPageLoad + * @private + */ + var isFirstPageLoad = true; /** * Davis.Requests are created from click and submit events. Davis.Requests are passed to Davis.Routes @@ -107,8 +113,15 @@ Davis.Request = (function () { this.fullPath = raw.fullPath; this.delegateToServer = raw.delegateToServer || Davis.noop; - this.isForPageLoad = raw.forPageLoad || false; + if (isFirstPageLoad) { + isFirstPageLoad = false; + this.isForPageLoad = true; + } else { + this.isForPageLoad = false; + } + // this.isForPageLoad = raw.forPageLoad || false; + if (Request.prev) Request.prev.makeStale(this); Request.prev = this;