@symbo.ls/router 2.12.61 → 2.12.64

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 +9 -5
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -5,9 +5,9 @@ import { redirectBasedOnAuth } from '@symbo.ls/auth-redirect'
5
5
  import { isModalRoute } from '@symbo.ls/platform-utils'
6
6
  import { deepMerge } 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
 
@@ -35,6 +35,7 @@ const defaultOptions = {
35
35
  preventContentUpdate: true,
36
36
  preventUpdate: ['Modal', 'MainHeaderCaptions', 'HeaderSubAside']
37
37
  },
38
+ preventUpdate: ['MainHeaderCaptions', 'HeaderSubAside'],
38
39
  setOptions: {},
39
40
  scrollToOffset: 120,
40
41
  scrollToOptions: { behavior: 'smooth' }
@@ -50,7 +51,7 @@ export const router = (
50
51
  lastLevel = options.level
51
52
 
52
53
  const [pathname, hash] = path.split('#')
53
- const rootRoute = getActiveRoute(0, path)
54
+ const rootRoute = getLocationPath(0, path)
54
55
  let routeArray = pathname.split('/')
55
56
 
56
57
  if (options.authCheck) {
@@ -89,7 +90,10 @@ export const router = (
89
90
  // || (!rootRouteHasChanged && { preventUpdateTriggerStateUpdate: true, preventContentUpdate: true })
90
91
 
91
92
  if (options.updateState) {
92
- element.state.update({ route, hash, routeInContent }, options.updateStateOptions)
93
+ element.state.update({ route, hash, routeInContent }, {
94
+ preventUpdate: options.preventUpdate,
95
+ ...options.updateStateOptions
96
+ })
93
97
  }
94
98
 
95
99
  if (!isModal && element.Modal) {
@@ -107,7 +111,7 @@ export const router = (
107
111
  extend: content
108
112
  }, {
109
113
  // ...(!isInitial && wasModal && !options.forceContentUpdate && { preventContentUpdate: true }),
110
- preventUpdate: ['MainHeaderCaptions', 'HeaderSubAside'],
114
+ preventUpdate: options.preventUpdate,
111
115
  ...options.setOptions
112
116
  })
113
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/router",
3
- "version": "2.12.61",
3
+ "version": "2.12.64",
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": "5d82942254ae88d047def5720cfc95b165cd3031",
14
+ "gitHead": "301d177fb42ff3de5ff2c3b6c3bd8711ba7c42f2",
15
15
  "source": "index.js"
16
16
  }