ionic-team / ionic-team/ionic-framework

bug: ionic react going back does not render correct view

未关闭
#22,679 7 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
package: react type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

# Bug Report

**Ionic React version:**
[ ] **4.x**
[x] **5.x**

**Current behavior:**
My app has four tabs. The second tab reuses CatalogPage component to display a tree-like structure of book catalogs. However, if I:
1. navigate to second level catalog in second tab
2. click the first tab
3. click the second tab
4. call this.props.history.goBack
, then the browser address bar URL is the first tab but the rendered page is the first level catalog in the second tab!

**Expected behavior:**
After the above step 4, then the browser address bar URL is the first tab AND the rendered page is the first tab!?

**Steps to reproduce:**
1. Setup the program:
```
git clone https://github.com/MrMYHuang/cbetar2.git
cd cbetar2
npm i
npm run start
```
2. Open http://localhost:3000/bookmarks
3. Click the second tab. The browser address bar will become http://localhost:3000/catalog
4. Click the first list item. The browser address bar will become http://localhost:3000/catalog/catalog/CBETA
5. Click the first tab. The browser address bar will become http://localhost:3000/bookmarks
6. Click the second tab. The browser address bar will become http://localhost:3000/catalog/catalog/CBETA
7. Click the top left back button. The browser address bar will become http://localhost:3000/bookmarks *BUT* the rendered page is actually the page!!!: http://localhost:3000/catalog

**Related code:**
The routes:

```
// https://github.com/MrMYHuang/cbetar2/blob/master/src/App.tsx



{/* The following route is for backward compatibility. */}
} exact={true} />
} exact={true} />
{/* The following route is for backward compatibility. */}
} exact={true} />
} exact={true} />
} exact={true} />
} exact={true} />
{/* The following route is for backward compatibility. */}
} exact={true} />
} exact={true} />
} exact={true} />
} exact={true} />
} exact={true} />
} />
{ return this.routeByQueryString(); }} exact={true} />

















```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。