Skip to content

bug: Navigating between instances of the same route with different parameters does not show updated content #22931

Closed

Description

@beneverard

Bug Report

Ionic version:
[ ] 4.x
[x] 5.x

Current behavior:
Navigating between instances of the same route with different parameters does not create a new version of the component, and thus does not show the correct data for the route.

Expected behavior:
When navigating between the same route with different parameter, a new component should be spawned with its own state, allowing navigation back to the previous and separate instance.

Steps to reproduce:

  1. Go to bug test example
  2. Go to the 1st message
  3. Click blue "Go To Message 5" button
  4. URL updates, but the component key/content does not change

(Note, I didn't setup Netlify redirects, so visit the root URL and navigate from within the app)

Related code:
This is the ion-button code, the only change made from the Vue sample:

<ion-button router-link="/message/5" routerDirection="forward" :detail="false" class="list-item">Go To Message 5</ion-button>

Other information:
This bug report says how components stay mounted in order to allow the state to be kept the same when navigating back through the history, but in this case the component is staying mounted and retains the original message data (index 0), instead of the new message data (index 5).

#20543

This makes sense but causes a problem in this situation.

Ionic info:

$ ionic info

Ionic:

   Ionic CLI       : 6.12.4 (/Users/beneverard/.config/yarn/global/node_modules/@ionic/cli)
   Ionic Framework : @ionic/vue 5.5.4

Capacitor:

   Capacitor CLI   : 2.4.6
   @capacitor/core : 2.4.6

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v15.7.0 (/usr/local/bin/node)
   npm    : 7.4.3
   OS     : macOS Catalina

Activity

  1. changed the title [-]bug: [/-] [+]bug: Navigating between instances of the same route with different parameters does not show udpated content[/+] on Feb 16, 2021
  2. liamdebeasi commented on Feb 16, 2021

    @liamdebeasi
    Contributor

    Thanks for the issue. I am going to close this as a duplicate of #22662.

  3. beneverard commented on Feb 16, 2021

    @beneverard
    Author

    Hi @liamdebeasi, thanks, I did see this after I just posted. I just want to check, in your bug report you say "The new page content simply appears.", whereas what I'm reporting here is that the new content doesn't display at all.

    Just want to make sure you're aware, they very well may be covering the same issue.

  4. liamdebeasi commented on Feb 16, 2021

    @liamdebeasi
    Contributor

    Thanks for clarifying! Yeah I think the two issues are related.

  5. beneverard commented on Feb 16, 2021

    @beneverard
    Author

    Thanks again Liam :-)

  6. changed the title [-]bug: Navigating between instances of the same route with different parameters does not show udpated content[/-] [+]bug: Navigating between instances of the same route with different parameters does not show updated content[/+] on Feb 19, 2021
  7. ionitron-bot commented on Mar 21, 2021

    @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.

  8. locked and limited conversation to collaborators on Mar 21, 2021
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

    No labels
    No 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