@lightningjs/blits 1.23.1 → 1.23.2

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
+ ## v1.23.2
4
+
5
+ _18 mar 2025_
6
+
7
+ - Fixed issue with keepAlive pages remaining in cache after navigating back
8
+
3
9
  ## v1.23.1
4
10
 
5
11
  _17 mar 2025_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "1.23.1",
3
+ "version": "1.23.2",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -328,15 +328,19 @@ const removeView = async (route, view, transition) => {
328
328
  }
329
329
 
330
330
  // cache the page when it's as 'keepAlive' instead of destroying
331
- if (route.options && route.options.keepAlive === true && navigatingBack === false) {
331
+ if (navigatingBack === false && route.options && route.options.keepAlive === true) {
332
332
  cacheMap.set(route.hash, { view: view, focus: previousFocus })
333
333
  } else if (navigatingBack === true) {
334
334
  // remove the previous route from the cache when navigating back
335
335
  // cacheMap.delete will not throw an error if the route is not in the cache
336
336
  cacheMap.delete(route.hash)
337
337
  }
338
-
339
- if (route.options && route.options.keepAlive !== true) {
338
+ /* Destroy the view in the following cases:
339
+ * 1. Navigating forward, and the previous route is not configured with "keep alive" set to true.
340
+ * 2. Navigating back, and the previous route is configured with "keep alive" set to true.
341
+ * 3. Navigating back, and the previous route is not configured with "keep alive" set to true.
342
+ */
343
+ if (route.options && (route.options.keepAlive !== true || navigatingBack === true)) {
340
344
  view.destroy()
341
345
  view = null
342
346
  }