Skip to content

Commit 1a5666e

Browse files
committed
Invert getRouteID default.
Something that "gets" shouldn't have a side effect by default.
1 parent 42692a0 commit 1a5666e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/createTransitionManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default function createTransitionManager(history, routes) {
9494

9595
let RouteGuid = 1
9696

97-
function getRouteID(route, create = true) {
97+
function getRouteID(route, create = false) {
9898
return route.__id__ || create && (route.__id__ = RouteGuid++)
9999
}
100100

@@ -156,7 +156,7 @@ export default function createTransitionManager(history, routes) {
156156
let unlistenBefore, unlistenBeforeUnload
157157

158158
function removeListenBeforeHooksForRoute(route) {
159-
const routeID = getRouteID(route, false)
159+
const routeID = getRouteID(route)
160160
if (!routeID) {
161161
return
162162
}
@@ -192,7 +192,7 @@ export default function createTransitionManager(history, routes) {
192192
*/
193193
function listenBeforeLeavingRoute(route, hook) {
194194
const thereWereNoRouteHooks = !hasAnyProperties(RouteHooks)
195-
const routeID = getRouteID(route)
195+
const routeID = getRouteID(route, true)
196196

197197
RouteHooks[routeID] = hook
198198

0 commit comments

Comments
 (0)