瀏覽代碼

fix(external_api): detect and skip params for hash routers

j8
Leonard Kim 6 年之前
父節點
當前提交
03f8d8b51a
共有 1 個檔案被更改,包括 11 行新增2 行删除
  1. 11
    2
      react/features/base/config/parseURLParams.js

+ 11
- 2
react/features/base/config/parseURLParams.js 查看文件

@@ -19,9 +19,18 @@ export default function parseURLParams(
19 19
         source: string = 'hash'): Object {
20 20
     const paramStr = source === 'search' ? url.search : url.hash;
21 21
     const params = {};
22
+    const paramParts = (paramStr && paramStr.substr(1).split('&')) || [];
22 23
 
23
-    // eslint-disable-next-line newline-per-chained-call
24
-    paramStr && paramStr.substr(1).split('&').forEach(part => {
24
+    // Detect and ignore hash params for hash routers.
25
+    if (source === 'hash' && paramParts.length === 1) {
26
+        const firstParam = paramParts[0];
27
+
28
+        if (firstParam.startsWith('/') && firstParam.split('&').length === 1) {
29
+            return params;
30
+        }
31
+    }
32
+
33
+    paramParts.forEach(part => {
25 34
         const param = part.split('=');
26 35
         const key = param[0];
27 36
 

Loading…
取消
儲存