File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -804,6 +804,11 @@ declare namespace Router {
804
804
*/
805
805
export function getActivePage ( ) : Lightning . Component | null ;
806
806
807
+ /**
808
+ * Returns the reference of the active Page instance
809
+ */
810
+ export function deletePage ( param : string ) : void ;
811
+
807
812
/**
808
813
* Returns the active route path blueprint
809
814
*/
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import {
44
44
beforeEachRoute ,
45
45
getActiveHash ,
46
46
getActiveRoute ,
47
+ deleteCurrentInstance ,
47
48
} from './utils/router'
48
49
49
50
import { focusWidget , getActiveWidget , restoreFocus } from './utils/widgets'
@@ -517,6 +518,10 @@ const root = () => {
517
518
}
518
519
}
519
520
521
+ const deletePage = ( param ) => {
522
+ deleteCurrentInstance ( param )
523
+ }
524
+
520
525
// export API
521
526
export default {
522
527
startRouter,
@@ -530,6 +535,7 @@ export default {
530
535
// warning
531
536
return getActivePage ( )
532
537
} ,
538
+ deletePage,
533
539
getActiveRoute,
534
540
getActiveHash,
535
541
focusWidget,
Original file line number Diff line number Diff line change @@ -299,6 +299,15 @@ export const getComponent = route => {
299
299
}
300
300
return null
301
301
}
302
+
303
+ // delete existing route instance from memory
304
+ export const deleteCurrentInstance = route => {
305
+ if ( components . has ( route ) && pagesHost . getIndex ( components . get ( route ) ) !== - 1 ) {
306
+ pagesHost . remove ( components . get ( route ) )
307
+ storeComponent ( route , components . get ( route ) . _routedType || components . get ( route ) . constructor )
308
+ }
309
+ }
310
+
302
311
/**
303
312
* Test if router needs to update browser location hash
304
313
* @returns {boolean }
You can’t perform that action at this time.
0 commit comments