From 2271b3c37442f84228c4b3c73078f583d5cd5270 Mon Sep 17 00:00:00 2001 From: Nathan Hammond Date: Fri, 23 Feb 2018 18:17:36 -0800 Subject: [PATCH] Change the test. --- lib/router/handler-info.js | 16 ---------------- .../transition-intent/named-transition-intent.js | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/router/handler-info.js b/lib/router/handler-info.js index f7a3266c..2cd87e3e 100644 --- a/lib/router/handler-info.js +++ b/lib/router/handler-info.js @@ -237,22 +237,6 @@ export default class HandlerInfo { } } -// this is bonkers, we require that `context` be set on on the -// HandlerInfo prototype to null because the checks in -// `NamedTransitionIntent.prototype.applyToHandlers` here -// https://github.com/tildeio/router.js/blob/v1.2.8/lib/router/transition-intent/named-transition-intent.js#L76-L81 -// check of `oldHandlerInfo.context === newHandlerInfo.context` and assumes -// that the params _must_ match also in that case. -// -// The only reason `oldHandlerInfo.context` and `newHandlerInfo.context` did not -// match in prior versions is because if the context isn't set yet (on newHandlerInfo) -// is because it inherits the `null` from the prototype vs `undefined` (on -// the oldHandlerInfo). -// -// A future refactoring should remove that conditional, and fix the hand full of -// failing tests. -HandlerInfo.prototype.context = null; - function paramsMatch(a, b) { if (!a ^ !b) { // Only one is null. diff --git a/lib/router/transition-intent/named-transition-intent.js b/lib/router/transition-intent/named-transition-intent.js index 8de04077..a06c7647 100644 --- a/lib/router/transition-intent/named-transition-intent.js +++ b/lib/router/transition-intent/named-transition-intent.js @@ -116,7 +116,7 @@ export default class NamedTransitionIntent extends TransitionIntent { var oldContext = oldHandlerInfo && oldHandlerInfo.context; if ( result.names.length > 0 && - oldContext !== null && + !!oldContext && newHandlerInfo.context === oldContext ) { // If contexts match in isActive test, assume params also match.