Skip to content

bug: routerLink forwards does not unmount origin component #19984

Closed

Description

@Rinbo

Bug Report

Ionic version:
[x] 4.11.5

Current behavior:

Using routerLink on for example IonCard with routerDirection="forward" does not unmount the origin component, thus not allowing clean up effect to take place.

Expected behavior:

When using router to navigate between pages I expect the page containing the link to be unmounted.

Steps to reproduce:

Create a Ionic/react starter project with sidemenu and add the following card to the Home component:

         <IonCard routerLink={"home/list"} routerDirection="forward">
            <IonCardHeader>
              <IonCardSubtitle>SUBHEADER</IonCardSubtitle>
              <IonCardTitle>CARD TITLE</IonCardTitle>
            </IonCardHeader>
            <IonCardContent>
              <p>CARD BODY HELLOOOOOOO</p>
            </IonCardContent>
          </IonCard>
        </IonCard>

Then navigate back and forth using the side menu and the routerLink on the component.

Activity

  1. Rinbo commented on Nov 23, 2019

    @Rinbo
    Author

    Apparently IonRouterOutlet is keeping the state intact. If I remove it I get my expected behaviour.

  2. ionitron-bot commented on Dec 23, 2019

    @ionitron-bot

    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.

  3. locked and limited conversation to collaborators on Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions