@lightningjs/blits 2.4.0 → 2.4.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.4.1
4
+
5
+ _02 jun 2026_
6
+
7
+ - Fixed router issue with initial redirect
8
+
3
9
  ## v2.4.0
4
10
 
5
11
  _1 june 2026_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -41,6 +41,8 @@ export default {
41
41
  return focusedComponent
42
42
  },
43
43
  set(component, event) {
44
+ if (component === undefined || component.eol === true) return
45
+
44
46
  clearTimeout(setFocusTimeout)
45
47
 
46
48
  // early return if already focused
@@ -75,7 +77,7 @@ export default {
75
77
 
76
78
  // and finally set focus to the leaf component
77
79
  setFocusTimeout = setTimeout(
78
- () => setFocus(component, event),
80
+ () => component.eol !== true && setFocus(component, event),
79
81
  this.hold === true ? Settings.get('holdTimeout', DEFAULT_HOLD_TIMEOUT_MS) : 0
80
82
  )
81
83
  },
@@ -408,33 +408,32 @@ const executeBeforeHook = async function (
408
408
  try {
409
409
  result = await hooks[hookName].call(parent, route, previousRoute)
410
410
  if (isString(result)) {
411
- currentRoute = previousRoute
412
- to(result)
411
+ this.currentRoute = previousRoute
412
+ to(result, {}, {}, this.name)
413
413
  return false
414
414
  }
415
415
  } catch (error) {
416
416
  Log.error(`Error or Rejected Promise in "${hookName}" Hook`, error)
417
+ this.currentRoute = previousRoute
417
418
  if (this.history.length > 0) {
418
419
  preventHashChangeNavigation = true
419
- currentRoute = previousRoute
420
- /// hmmmm
421
420
  window.history.back()
422
421
  navigatingBack = false
423
422
  state.navigating = false
424
- return false
425
423
  }
424
+ return false
426
425
  }
427
426
  // If the resolved result is an object, redirect if the path in the object was changed
428
427
  if (isObject(result) === true && result.path !== currentPath) {
429
- currentRoute = previousRoute
430
- to(result.path, result.data, result.options)
428
+ this.currentRoute = previousRoute
429
+ to(result.path, result.data, result.options, this.name)
431
430
  return false
432
431
  }
433
432
  // If the resolved result is false, cancel navigation
434
433
  if (result === false) {
434
+ this.currentRoute = previousRoute
435
435
  if (this.history.length > 0) {
436
436
  preventHashChangeNavigation = true
437
- currentRoute = previousRoute
438
437
  window.history.back()
439
438
  navigatingBack = false
440
439
  state.navigating = false
@@ -491,11 +490,11 @@ const executeTransition = async (transition, element, animate) => {
491
490
  }
492
491
  }
493
492
 
494
- export const to = (path, data = {}, options = {}) => {
493
+ export const to = (path, data = {}, options = {}, routerViewName = '') => {
495
494
  navigationData = data
496
495
  overrideOptions = options
497
496
 
498
- setHash(path)
497
+ setHash(path, routerViewName)
499
498
  }
500
499
 
501
500
  export const toRouterView = (routerView, path, data = {}, options = {}) => {