Skip to content

Commit

Permalink
Invert getRouteID default.
Browse files Browse the repository at this point in the history
Something that "gets" shouldn't have a side effect by default.
  • Loading branch information
timdorr committed Apr 21, 2016
1 parent 42692a0 commit 1a5666e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/createTransitionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default function createTransitionManager(history, routes) {

let RouteGuid = 1

function getRouteID(route, create = true) {
function getRouteID(route, create = false) {
return route.__id__ || create && (route.__id__ = RouteGuid++)
}

Expand Down Expand Up @@ -156,7 +156,7 @@ export default function createTransitionManager(history, routes) {
let unlistenBefore, unlistenBeforeUnload

function removeListenBeforeHooksForRoute(route) {
const routeID = getRouteID(route, false)
const routeID = getRouteID(route)
if (!routeID) {
return
}
Expand Down Expand Up @@ -192,7 +192,7 @@ export default function createTransitionManager(history, routes) {
*/
function listenBeforeLeavingRoute(route, hook) {
const thereWereNoRouteHooks = !hasAnyProperties(RouteHooks)
const routeID = getRouteID(route)
const routeID = getRouteID(route, true)

RouteHooks[routeID] = hook

Expand Down

0 comments on commit 1a5666e

Please sign in to comment.