browserHistoryOnLoad doesn’t work with me on refresh
in index html have a link to dashboard
<div id="app">
<div class="view view-main">
<div data-name="home" class="page">
<div class="page-content">
<h1>welcome Screen</h1>
<ul>
<li><a href="/dashboard/" >Dashboard</a></li>
<li> <a href="/login/" >login</a> </li>
</ul>
</div>
</div>
</div>
</div>
js code
var routes = [
{
path: '/',
url: './index.html',
},
{
path: '/dashboard/',
url: './pages/dashboard/dashboard.html',
},
{
path: '/login/',
url: './login.html',
},
];
app = new Framework7({
id: 'myapp',
el: '#app',
theme: 'ios',
name: 'my app',
routes: routes,
}
mainView = app.views.create('.view-main', {
url: '/',
browserHistory: true,
browserHistoryRoot: "http://localhost:5000",
browserHistorySeparator: '',
browserHistoryOnLoad: true,
browserHistoryInitialMatch: true,
});
after my application load on http://localhost:5000 i can navigate to dashboard without problem the new url is http://localhost:5000/dashboard/
when i try to refresh on the new url the app loaded on index -welcome page at index- and doesnt navigate to dashboard page. while the url stayed at dashboard…
my work around was adding refreshPage
mainView.router.refreshPage(); //add this after mainView create
the work around helped and the dashboard loaded, the pageInit will be called twice AND console show following error which afraid to break the application cycle.
Uncaught (in promise) Error: canceled at p.abortController.onAbort (framework7-bundle.min.js:13:43434) at Object.abort (framework7-bundle.min.js:13:47293) at St (framework7-bundle.min.js:13:85066) at framework7-bundle.min.js:13:115502 at Array.forEach (<anonymous>) at h (framework7-bundle.min.js:13:115467) at framework7-bundle.min.js:13:116853 at framework7-bundle.min.js:13:73473 at t (framework7-bundle.min.js:13:73158) at resolve (framework7-bundle.min.js:13:73211)
any suggestion to have the best practice removing the error, and prevent double initialize of page
THANKS