Skip to content

Commit

Permalink
Change the test.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhammond authored and Nathan Hammond committed Feb 24, 2018
1 parent 2273bd2 commit 2271b3c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
16 changes: 0 additions & 16 deletions lib/router/handler-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/router/transition-intent/named-transition-intent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2271b3c

Please sign in to comment.