Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Ionic 4.11.2 and React - navigation causes a stack overflow #19732

Closed
marcoromag opened this issue Oct 23, 2019 · 2 comments
Closed

bug: Ionic 4.11.2 and React - navigation causes a stack overflow #19732

marcoromag opened this issue Oct 23, 2019 · 2 comments
Labels
package: react @ionic/react package

Comments

@marcoromag
Copy link

marcoromag commented Oct 23, 2019

Hi,

Since Ionic 4.11.2, there is a major issue in the navigation: navigating to a page that is already in the stack causes a stack overflow.
Below you can find a simple snipped of a crashing app...

Test: run app. Click on button 'Go to Page B'. Click on button 'Go to Page C'. Click on button 'Go to Page A'.
Expected behaviour: normal navigation works
Current behaviour: Browser crashes with
[Error] RangeError: Maximum call stack size exceeded.
removeOrphanedViews (9.chunk.js:7198)
(anonymous function) (9.chunk.js:7202)
forEach
removeOrphanedViews (9.chunk.js:7201)
(anonymous function) (9.chunk.js:7202)
forEach
removeOrphanedViews (9.chunk.js:7201)
(anonymous function) (9.chunk.js:7202)
forEach
removeOrphanedViews (9.chunk.js:7201)
...

const createPage = (title: string, next: string) : React.FC => () => (
  <IonPage>
    <IonHeader>
      <IonToolbar>
          <IonButtons slot="start">
             <IonBackButton/>
          </IonButtons>
          {title}
      </IonToolbar>
    </IonHeader>
    <IonContent>
      <IonButton routerLink={`/${next}`}>Go to page {next}</IonButton>
    </IonContent>
  </IonPage>
)

const App: React.FC = () => (
  <IonApp>
    <IonReactRouter>
        <IonRouterOutlet>
          <Route exact path="/A" component={createPage('Page A','B')}/>
          <Route exact path="/B" component={createPage('Page B','C')}/>
          <Route exact path="/C" component={createPage('Page C','A')}/>
          <Route exact path="/" render={() => <Redirect to="/A" />} />
        </IonRouterOutlet>
    </IonReactRouter>
  </IonApp>
);
@elylucas
Copy link
Contributor

Hi @marcoromag,

Thanks for the issues and for providing good test cases, they helped quite a bit in finding the bug. These are fixed in the code base and will be out in the next 4.11.3 release.

obedm503 added a commit to obedm503/nuffread that referenced this issue Oct 27, 2019
elylucas added a commit that referenced this issue Oct 30, 2019
mhartington pushed a commit that referenced this issue Oct 31, 2019
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 22, 2019

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: react @ionic/react package
Projects
None yet
Development

No branches or pull requests

3 participants