I have an app where I'm using a <Popup> without a router (<View router=false>). If I navigate within my app to show the Popup, and then reload the page in the browser, it initialises the app with the Popup shown according to the URL. However, when I click to close the Popup and return to the main view I encounter an error.
This seems to be due to the code in routing-kernel.js expecting all views to have a router. However, when the router=false JSX attribute is used this is not the case and so it causes issues.
A simple fix would be to change the if statement in the forEach loop to check for router before checking the length of the router.history array. At least if I manually edit my local NPM package this works.
if (router.history.length) -- becomes --> if (router && router.history.length)
RoutingKernel.prototype.initializeHistory = function () {
var _this = this;
var mainView = this.framework7.views.find(function (view) { return view.main; });
if (!mainView) {
throw new Error('Framework7 Redux requires a main view');
}
this.framework7.views.forEach(function (view) {
var router = view.router;
if (router && router.history.length) {
router.history.forEach(function (f7HistoryUrl) {
_this.dispatchAction(routing_actions_1.navigateTo(f7HistoryUrl, false, view.name || view.main && 'main'));
});
}
});
};
@bencompton Any chance you can make this small change ?
I have an app where I'm using a
<Popup>without a router (<View router=false>). If I navigate within my app to show the Popup, and then reload the page in the browser, it initialises the app with the Popup shown according to the URL. However, when I click to close the Popup and return to the main view I encounter an error.This seems to be due to the code in routing-kernel.js expecting all views to have a router. However, when the
router=falseJSX attribute is used this is not the case and so it causes issues.A simple fix would be to change the if statement in the forEach loop to check for router before checking the length of the router.history array. At least if I manually edit my local NPM package this works.
if (router.history.length)-- becomes -->if (router && router.history.length)@bencompton Any chance you can make this small change ?