@domql/router 2.3.7 → 2.3.10

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 +4 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -13,7 +13,8 @@ const defaultOptions = {
13
13
  pushState: true,
14
14
  scrollToTop: true,
15
15
  scrollToNode: false,
16
- useFragment: false
16
+ useFragment: false,
17
+ updateState: true
17
18
  }
18
19
 
19
20
  export const router = (
@@ -28,13 +29,13 @@ export const router = (
28
29
  const [pathname, hash] = (path).split('#')
29
30
 
30
31
  const route = getActiveRoute(pathname, options.level)
31
- const content = element.routes[route]
32
+ const content = element.routes[route] || element.routes['/*']
32
33
 
33
34
  if (content) {
34
35
  if (options.pushState) window.history.pushState(state, null, pathname + (hash ? `#${hash}` : ''))
35
36
 
36
37
  element.set({ tag: options.useFragment && 'fragment', extend: content })
37
- element.state.update({ route, hash })
38
+ if (options.updateState) element.state.update({ route, hash })
38
39
 
39
40
  const rootNode = element.node
40
41
  if (options.scrollToTop) rootNode.scrollTo({ behavior: 'smooth', top: 0, left: 0 })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "2.3.7",
3
+ "version": "2.3.10",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -9,6 +9,6 @@
9
9
  "dependencies": {
10
10
  "@domql/utils": "latest"
11
11
  },
12
- "gitHead": "c8dcd776f492f22109580cc44aa5db7e13d43bde",
12
+ "gitHead": "1b8dacf169c7926e31637085a9bc13afdabddfe8",
13
13
  "source": "index.js"
14
14
  }