From 5e239a87ae5768178a8ae28fd0cf4cff6bad2a6a Mon Sep 17 00:00:00 2001 From: Prageeth Silva Date: Sun, 18 Jul 2021 20:13:12 +0200 Subject: [PATCH 1/3] fix the `wth` exception --- src/router.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/router.js b/src/router.js index a037f69..6b763e5 100644 --- a/src/router.js +++ b/src/router.js @@ -239,6 +239,10 @@ const process = (stackObj, directCall) => { reducedPath: previousReducedPath } = stackObj; + if (!stack[routerId]) { + return; + } + const currentPath = getWorkingPath(parentRouterId); let route = null; let targetFunction = null; @@ -270,10 +274,6 @@ const process = (stackObj, directCall) => { break; } - if (!stack[routerId]) { - return; - } - if (!anyMatched) { route = null; targetFunction = null; From cdf98befc6c4a5501dc86bb6a830991e476e4a96 Mon Sep 17 00:00:00 2001 From: Prageeth Silva Date: Sun, 18 Jul 2021 20:13:52 +0200 Subject: [PATCH 2/3] add comment for the wth error --- src/router.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/router.js b/src/router.js index 6b763e5..2b893da 100644 --- a/src/router.js +++ b/src/router.js @@ -172,6 +172,7 @@ export const getWorkingPath = (parentRouterId) => { } const stackEntry = stack[parentRouterId]; if (!stackEntry) { + // this should not be reached at all throw 'wth'; } From 85e1e81b1e471e29511652ca2a843746427b5a96 Mon Sep 17 00:00:00 2001 From: Prageeth Silva Date: Sun, 18 Jul 2021 20:18:05 +0200 Subject: [PATCH 3/3] fix indentation --- src/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router.js b/src/router.js index 2b893da..1dafebb 100644 --- a/src/router.js +++ b/src/router.js @@ -172,7 +172,7 @@ export const getWorkingPath = (parentRouterId) => { } const stackEntry = stack[parentRouterId]; if (!stackEntry) { - // this should not be reached at all + // this should not be reached at all throw 'wth'; }