@symbo.ls/router 2.12.62 → 2.12.65

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 +11 -11
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -3,11 +3,11 @@
3
3
  import { setCookie } from '@domql/cookie'
4
4
  import { redirectBasedOnAuth } from '@symbo.ls/auth-redirect'
5
5
  import { isModalRoute } from '@symbo.ls/platform-utils'
6
- import { deepMerge } from '@domql/utils'
6
+ import { merge } from '@domql/utils'
7
7
 
8
- export const getActiveRoute = (level = 0, route = window.location.pathname) => {
8
+ export const getLocationPath = (index = 0, route = window.location.pathname) => {
9
9
  const routeArray = route.split('/')
10
- const activeRoute = routeArray[level + 1]
10
+ const activeRoute = routeArray[index + 1]
11
11
  if (activeRoute) return `/${activeRoute}`
12
12
  }
13
13
 
@@ -47,11 +47,11 @@ export const router = (
47
47
  state = {},
48
48
  passedOptions = {}
49
49
  ) => {
50
- const options = deepMerge(passedOptions, defaultOptions)
50
+ const options = merge(passedOptions, defaultOptions)
51
51
  lastLevel = options.level
52
52
 
53
53
  const [pathname, hash] = path.split('#')
54
- const rootRoute = getActiveRoute(0, path)
54
+ const rootRoute = getLocationPath(0, path)
55
55
  let routeArray = pathname.split('/')
56
56
 
57
57
  if (options.authCheck) {
@@ -96,12 +96,6 @@ export const router = (
96
96
  })
97
97
  }
98
98
 
99
- if (!isModal && element.Modal) {
100
- element.Modal.removeContent()
101
- } else if (isModal && element.content?.Tabs) {
102
- element.content.Tabs.update()
103
- }
104
-
105
99
  if (hasSet) {
106
100
  if (options.forceContentUpdate || (!isInitial && wasModal)) {
107
101
  element.content.update()
@@ -116,6 +110,12 @@ export const router = (
116
110
  })
117
111
  }
118
112
  }
113
+
114
+ if (!isModal && element.Modal.content) {
115
+ element.Modal.removeContent()
116
+ } else if (isModal && element.content?.Tabs) {
117
+ element.content.Tabs.update()
118
+ }
119
119
  }
120
120
 
121
121
  const rootNode = element.node
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/router",
3
- "version": "2.12.62",
3
+ "version": "2.12.65",
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": "c4a5ed5b900cf83573a4b15c5c86dc4a568fd589",
14
+ "gitHead": "6590c42ef1d9670bc29e76efc22962abf4c49196",
15
15
  "source": "index.js"
16
16
  }