Skip to content

Commit

Permalink
fix(react): add check to warn if no ionpage is found, fixes #19832 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
elylucas committed Nov 7, 2019
1 parent d89508b commit 628e766
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/react-router/src/ReactRouter/Router.tsx
Expand Up @@ -4,7 +4,7 @@ import { Action as HistoryAction, Location as HistoryLocation, UnregisterCallbac
import React from 'react';
import { RouteComponentProps, matchPath, withRouter } from 'react-router-dom';

import { generateId } from '../utils';
import { generateId, isDevMode } from '../utils';
import { LocationHistory } from '../utils/LocationHistory';

import { IonRouteData } from './IonRouteData';
Expand Down Expand Up @@ -169,6 +169,18 @@ class RouteManager extends React.Component<RouteComponentProps, RouteManagerStat
leavingEl.classList.add('ion-page-hidden');
leavingEl.setAttribute('aria-hidden', 'true');
}

// Warn if an IonPage was not eventually rendered in Dev Mode
if (isDevMode()) {
if (enteringView.routeData.match!.url !== location.pathname) {
setTimeout(() => {
const { view } = this.state.viewStacks.findViewInfoById(this.activeIonPageId);
if (view!.routeData.match!.url !== location.pathname) {
console.warn('No IonPage was found to render. Make sure you wrap your page with an IonPage component.');
}
}, 1000);
}
}
}
});
}
Expand Down

0 comments on commit 628e766

Please sign in to comment.