question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: [ionic-react] Route change trigger url change, but doesn't render

See original GitHub issue

Bug Report

Ionic version:

[x] @ionic/react: “^5.0.4”, [x] @ionic/react-router: “^5.0.4”

Current behavior: Despite changing the URL, the view doesn’t rerender. Another error is that I never go to useIonViewDidEnter. I have this in the Home page :

  useIonViewDidEnter(() => {
    console.log('hoooho')
  })

But the log never show up.

Here is a short video of the bug.

Mar-06-2020 09-46-12

Expected behavior: I wish it would change page without any problem.

Steps to reproduce: You can :

git clone https://github.com/florianchevallier/ionic-react-test
cd ionic-react-test
npm i
ionic serve

Click on the “Pokedex” Button on the home page

Related code:

The router : https://github.com/florianchevallier/ionic-react-test/blob/master/src/App.tsx The Home Page : https://github.com/florianchevallier/ionic-react-test/blob/master/src/pages/Home/Home.tsx

Ionic info:

Ionic:

   Ionic CLI       : 6.2.0 (/Users/florianchevallier/.nvm/versions/node/v12.13.1/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 5.0.4

Capacitor:

   Capacitor CLI   : 1.5.0
   @capacitor/core : 1.5.0

Utility:

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

System:

   NodeJS : v12.13.1 (/Users/florianchevallier/.nvm/versions/node/v12.13.1/bin/node)
   npm    : 6.12.1
   OS     : macOS Catalina

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
florianchevalliercommented, Mar 6, 2020

After doing some investigations, replacing the IonRouterOutlet with a Switch from react-router-dom, all seems to work.

1reaction
elylucascommented, Apr 29, 2020

Hi @florianchevallier

Sorry about the delay in taking a look at this.

I checked out your repo, and it seems the issue when using the IonRouterOutlet is that your pages didn’t have a IonPage as their main component. Each page in a outlet needs to have the IonPage as its parent.

Also, there seems to be some duplication of IonContent tags in your pages (some in the page, and some in the layout), there should only be one IonContent per page.

Going to close this as it doesn’t seem as the original issue is a bug in the framework.

For the others on the thread, if the above doesn’t help, please open a new issue and provide a reproduction of the issue in a github repo.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic-react - so many render issues related to routing
I am trying to nest routes at different levels of my React component tree but it seems that wrapping lower-level routes with the...
Read more >
URL changes but page new page is not rendered Ionic React ...
I am trying to do this by pushing the new URL onto the react router history prop when I get a successful response...
Read more >
Tutorial v6.6.1 - React Router
Open it up and we'll put React Router on the page. Create and render a browser router in main.jsx. import React from "react";...
Read more >
[Solved]-React router changes url but not view-Reactjs
push or props.history.push from any component, you may face the issue of not rendering the component while changing the URL. You can fix...
Read more >
Angular Router: Child Routes, Auxiliary Routes, Master Detail
Setup a home route and a fallback route, learn why order matters; Router navigation using routerLink; Master-Detail with Child Routes - how do ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found