ionic-team / ionic-team/ionic-framework

bug: reatct, route jump using replace will not destroy the page dom

Aperta
#25,640 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub
package: react type: bug
Lingua principale
TypeScript
Stelle
52.7k
Fork
13.3k
Merge medio
1g 15h
PR unite (30g)
51

Descrizione

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

- [ ] v4.x
- [X] v5.x
- [x] v6.x
- [ ] Nightly

### Current Behavior

When I use replace in the jump path, it causes the page to stay in the dom forever. Will not be destroyed, enter the page again, the useEffect method will not be executed。

for example :
/test/test1 (replace)-> /test/test2/:location (replace) -> /test/test3/:location (push) -> /test/test4/:location (navigate('/test/test1', 'back', 'pop')) -> /test/test1 (replace)-> /test/test2/:location (replace) -> /test/test3/:location

Finally, when you enter the test3 page, you cannot get the latest parameters of history params, and the useEffect method will not be executed.

### Expected Behavior

Hope to get the latest parameters and executed useEffect function,It now appears that the page remains in the dom and is not destroyed.

### Steps to Reproduce

/test/test1 (replace)-> /test/test2/:location (replace) -> /test/test3/:location (push) -> /test/test4/:location (navigate('/test/test1', 'back', 'pop')) -> /test/test1 (replace)-> /test/test2/:location (replace) -> /test/test3/:location

Reproducible using the project I provided

### Code Reproduction URL

https://github.com/yunfeng-weee/ionic-router-question

### Ionic Info

Ionic:

Ionic CLI : 6.20.1 (D:\nvm\v14.18.1\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 5.9.4

Capacitor:

Capacitor CLI : 3.6.0
@capacitor/android : 3.6.0
@capacitor/core : 3.6.0
@capacitor/ios : 3.6.0

Utility:

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

System:

NodeJS : v14.18.1 (D:\nodejs\node.exe)
npm : 6.14.15
OS : Windows 10

### Additional Information

_No response_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by running the linked reproduction project and following the reported route sequence from /test/test1 through /test/test4, using the @ionic/react 5.9.4 setup described in the issue. Verify whether returning to /test/test3 leaves the page in the DOM, fails to receive the latest history parameters, and skips useEffect; done means the reproduced navigation updates correctly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.