Skip to content

fix(react): Nav unmounts component while invoking popTo or popToRoot #27821

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

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

zhbhun
Copy link
Contributor

@zhbhun zhbhun commented Jul 19, 2023

Issue number: Resolves #27798


What is the current behavior

React IonNav component's views are missing keys, leading to unnecessary duplicate mounting of components.

What is the new behavior?

  • Adds key to views of React IonNav component.

Does this introduce a breaking change?

  • Yes
  • No

@zhbhun zhbhun requested a review from averyjohnston as a code owner July 19, 2023 04:12
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions bot added the package: react @ionic/react package label Jul 19, 2023
@sean-perkins sean-perkins self-assigned this Sep 19, 2023
@sean-perkins sean-perkins changed the title fix(nav): Component mount only once while invoking popTo or popToRoot… fix(react): Nav unmounts component while invoking popTo or popToRoot Sep 19, 2023
@sean-perkins sean-perkins removed their assignment Sep 19, 2023
@sean-perkins sean-perkins self-requested a review September 19, 2023 21:14
Copy link
Contributor

@sean-perkins sean-perkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution!

I ended up checking out your branch and pushing some changes to avoid an API change to the ReactDelegate. We can create a unique id for each delegate constructed and increment a counter for each view pushed onto the stack.

I've also updated the test app to check that the page unmounted lifecycle is called when popping to the root of the stack.

Once we have another +1 from the team, this is good to go 🎉

@averyjohnston averyjohnston added this pull request to the merge queue Sep 20, 2023
@averyjohnston
Copy link
Contributor

Thank you!

Merged via the queue into ionic-team:main with commit 0edcb2c Sep 20, 2023
liamdebeasi pushed a commit that referenced this pull request Sep 22, 2023
…27821)

Issue number: Resolves #27798

---------

## What is the current behavior

React IonNav component's views are missing keys, leading to unnecessary
duplicate mounting of components.


## What is the new behavior?
- Adds key to views of React IonNav component.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

---------

Co-authored-by: Sean Perkins <[email protected]>
liamdebeasi pushed a commit that referenced this pull request Sep 26, 2023
…27821)

Issue number: Resolves #27798

---------

## What is the current behavior

React IonNav component's views are missing keys, leading to unnecessary
duplicate mounting of components.


## What is the new behavior?
- Adds key to views of React IonNav component.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

---------

Co-authored-by: Sean Perkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: react @ionic/react package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Component mount repeatedly while invoking popTo or popToRoot of IonNav
3 participants