Skip to content

Commit 1bf60b9

Browse files
Fixed memoryleak on shared routes with lazyCreate false
1 parent 71d7708 commit 1bf60b9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Router/utils/router.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,21 @@ const cleanUp = (page, request) => {
366366

367367
let doCleanup = false
368368

369+
// if this request is executed due to a step back in history
370+
// and we have configured to destroy active page when we go back
371+
// in history or lazyDestory is enabled
369372
if (isFromHistory && (destroyOnBack || lazyDestroy)) {
370373
doCleanup = true
371-
} else if (lazyDestroy && !keepAlive) {
374+
}
375+
376+
// clean up if lazyDestroy is enabled and the keepAlive flag
377+
// in navigation register is false
378+
if (lazyDestroy && !keepAlive) {
379+
doCleanup = true
380+
}
381+
382+
// if the current and new request share the same route blueprint
383+
if (activeRoute === request.route.path) {
372384
doCleanup = true
373385
}
374386

0 commit comments

Comments
 (0)