Repository navigation
fix(react): nav will remove components from the DOM - #25763
Conversation
| const hostComponent = refMap.get(component); | ||
| hostComponent && removeView(hostComponent); | ||
|
|
||
| component.remove(); |
There was a problem hiding this comment.
Are there any considerations we need to make with conditionally rendering pages similar to #25663?
There was a problem hiding this comment.
I do not believe the same considerations apply for IonNav. With IonModal the React node is relocated in the DOM and this causes potential issues when the surrounding React nodes are added or removed (causing React to incorrect remove the modal reference - which is why we render the template buffer elements). With IonNav the React node is stable and the components are added/removed as children of the IonNav.
liamdebeasi
left a comment
There was a problem hiding this comment.
My question in https://github.com/ionic-team/ionic-framework/pull/25763/files#r952650655 still stands, but otherwise this approach looks great. Nice work!
|
@liamdebeasi I additionally verified with conditionally rendering a modal with an
|
Issue #: resolves #25753
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docsrepo, in a separate PR. See the contributing guide for details.npm run build) was run locally and any changes were pushednpm run lint) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
When
IonNavperforms a pop operation (navigating to root, back, etc.) the views are not removed from the DOM.What is the new behavior?
IonNavremoves pages from the DOM when they are popped (navigate back, navigate to root, etc.)Does this introduce a breaking change?
Other information