Hi, I put together a mini app to try to clear completely, from the memory/history, a page when the user navigate back, using settings: lazyDestroy false and destroyOnHistoryBack true.
I have a router with 2 pages. The default one is Home and the second one is Article. The article page has a dynamic route: article/:id.
From Home I go in the Article page and show its id, then I go back in Home with Router.step(-1) and then I go in Article again but this time I am passing a different id on the route. I am expecting to see shown only the second id but the first one is still there.
What am I doing wrong?
Thanks in advance.
Hi, I put together a mini app to try to clear completely, from the memory/history, a page when the user navigate back, using settings: lazyDestroy false and destroyOnHistoryBack true. I have a router with 2 pages. The default one is Home and the second one is Article. The article page has a dynamic route: article/:id. From Home I go in the Article page and show its id, then I go back in Home with Router.step(-1) and then I go in Article again but this time I am passing a different id on the route. I am expecting to see shown only the second id but the first one is still there. What am I doing wrong? Thanks in advance.
Here is my settings.json
{ "appSettings": { "stage": { "clearColor": "0x00000000", "useImageWorker": true }, "debug": false }, "platformSettings": { "path": "./static", "log": true, "showVersion": true, "showFps": false, "numberNavigation": false, "router": { "destroyOnHistoryBack": true, "lazyDestroy": false, "gcOnUnload": true } } }
Here is my App.js `import { Lightning, Utils, Router } from 'wpe-lightning-sdk'
import routes from './routes';
export default class App extends Lightning.Component { static getFonts() { return [{ family: 'Regular', url: Utils.asset('fonts/Roboto-Regular.ttf') }] }
static _template() { return { Background: { w: 1920, h: 1080, color: 0xfffbb03b, src: Utils.asset('images/background.png'), }, Pages: { w: 1920, h: 1080, forceZIndexContext: true, }, } }
_captureLeft() { Router.step(-1); }
_setup() { Router.startRouter(routes, this); }
} `
Here is my routes.js
import Home from './Home'; import Article from './Article'; export default { root: 'home', routes: [ { path: 'home', component: Home, }, { path: 'article/:id', component: Article, }, ], };
Here is my Article.js `import {Lightning} from 'wpe-lightning-sdk'; export default class Article extends Lightning.Component { static _template() { return { rect: true, color: 0xff000000, w: 1920, h: 1080, Debug: { text: { text: '', }, }, }; }
} `
Here is a screenshot of the first time in the article (with url path)
Here is a screenshot of the second time in the article (with url path)