ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: redundant rerender when switch router

Open F3n67u opened this issue 3 years ago • 0 comments

Prerequisites

Ionic Framework Version

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

Current Behavior

When switching the router between two pages, both page components will rerender 4 times.

Expected Behavior

When switching the router between two pages, the target page should only render 1 time. The old page should not be rerendered.

Steps to Reproduce

  1. Go to https://codesandbox.io/s/ionic-react-rerender-5vf2lj
  2. Click the "Brew" tab
  3. then switch to the "Settings" tab
  4. You will see the "render Brew" and "render Settings" log will print 4 times each

Code Reproduction URL

https://codesandbox.io/s/ionic-react-rerender-5vf2lj

Ionic Info

Because the repro is in codesandbox, I cannot run ionic info.

    "@ionic/react": "6.2.8-nightly.20220915",
    "@ionic/react-router": "6.2.8-nightly.20220915",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-router": "5.2.0",
    "react-router-dom": "5.2.0",

Additional Information

Maybe duplicated with https://github.com/ionic-team/ionic-framework/issues/22426 and https://github.com/ionic-team/ionic-framework/issues/24107, but those issue is still not fixed even in the latest release version. so I created this new issue.

F3n67u avatar Sep 16 '22 04:09 F3n67u