From 03f8d8b51a268eeb66117c6ec3d8c80b8303e78f Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Thu, 21 Feb 2019 15:30:02 -0800 Subject: [PATCH] fix(external_api): detect and skip params for hash routers --- react/features/base/config/parseURLParams.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/react/features/base/config/parseURLParams.js b/react/features/base/config/parseURLParams.js index 097c9869a..8cfebe478 100644 --- a/react/features/base/config/parseURLParams.js +++ b/react/features/base/config/parseURLParams.js @@ -19,9 +19,18 @@ export default function parseURLParams( source: string = 'hash'): Object { const paramStr = source === 'search' ? url.search : url.hash; const params = {}; + const paramParts = (paramStr && paramStr.substr(1).split('&')) || []; - // eslint-disable-next-line newline-per-chained-call - paramStr && paramStr.substr(1).split('&').forEach(part => { + // Detect and ignore hash params for hash routers. + if (source === 'hash' && paramParts.length === 1) { + const firstParam = paramParts[0]; + + if (firstParam.startsWith('/') && firstParam.split('&').length === 1) { + return params; + } + } + + paramParts.forEach(part => { const param = part.split('='); const key = param[0];