@symbo.ls/router 2.12.89 → 2.12.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +6 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -52,7 +52,9 @@ export const router = (
52
52
  const options = merge(passedOptions, defaultOptions)
53
53
  lastLevel = options.level
54
54
 
55
- const [pathname, hash] = path.split('#')
55
+ const urlObj = new options.window.URL(options.window.location.origin + path)
56
+ const { pathname, search, hash } = urlObj
57
+
56
58
  const rootRoute = getLocationPath(0, path)
57
59
  let routeArray = pathname.split('/')
58
60
 
@@ -73,7 +75,7 @@ export const router = (
73
75
 
74
76
  const wasModal = isModalRoute(options.window.location.pathname.split('#')[0], element)
75
77
  const isInitial = options.initialRender
76
- const hashChanged = hash && hash !== options.window.location.hash.slice(1)
78
+ const hashChanged = hash && hash !== options.window.location.hash
77
79
  const pathChanged = pathname !== lastPathname
78
80
  lastPathname = pathname
79
81
 
@@ -81,7 +83,7 @@ export const router = (
81
83
  if (options.pushState) {
82
84
  options.window.history.pushState({
83
85
  prevUrl: options.window.location.href, ...state
84
- }, null, route + (hash ? `#${hash}` : ''))
86
+ }, null, route + (search ? `${search}` : '') + (hash ? `${hash}` : ''))
85
87
  }
86
88
 
87
89
  const isModal = !!isModalRoute(pathname, element)
@@ -93,6 +95,7 @@ export const router = (
93
95
  if (options.updateState) {
94
96
  element.state.update({ route, hash, routeInContent, debugging: false }, {
95
97
  preventUpdate: options.preventUpdate,
98
+ updateByRouter: true,
96
99
  ...options.updateStateOptions
97
100
  })
98
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/router",
3
- "version": "2.12.89",
3
+ "version": "2.12.94",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -11,6 +11,6 @@
11
11
  "@domql/utils": "latest",
12
12
  "@symbo.ls/auth-redirect": "latest"
13
13
  },
14
- "gitHead": "139bed3c8f506cf74bbaf4753aadd7ab4daa3c9a",
14
+ "gitHead": "e09e8a3656bcb86dcd9965b7eb0a484c976fc8ec",
15
15
  "source": "index.js"
16
16
  }