Skip to content

Commit 61f04e5

Browse files
authored
Master react (ionic-team#19439)
chore(react): react rc3 release
1 parent e90e960 commit 61f04e5

File tree

15 files changed

+71
-39
lines changed

15 files changed

+71
-39
lines changed

packages/react-router/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ionic/react-router",
3-
"version": "4.9.0-rc.2",
3+
"version": "4.10.0-rc.3",
44
"description": "React Router wrapper for @ionic/react",
55
"keywords": [
66
"ionic",
@@ -37,16 +37,16 @@
3737
"tslib": "*"
3838
},
3939
"peerDependencies": {
40-
"@ionic/core": "^4.9.0",
41-
"@ionic/react": "4.9.0-rc.2",
40+
"@ionic/core": "^4.10.0",
41+
"@ionic/react": "4.10.0-rc.3",
4242
"react": "^16.8.6",
4343
"react-dom": "^16.8.6",
4444
"react-router": "^5.0.1",
4545
"react-router-dom": "^5.0.1"
4646
},
4747
"devDependencies": {
48-
"@ionic/core": "^4.9.0",
49-
"@ionic/react": "4.9.0-rc.2",
48+
"@ionic/core": "^4.10.0",
49+
"@ionic/react": "4.10.0-rc.3",
5050
"@types/jest": "^23.3.9",
5151
"@types/node": "12.6.9",
5252
"@types/react": "^16.9.2",

packages/react-router/src/ReactRouter/NavManager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Location as HistoryLocation, UnregisterCallback } from 'history';
44
import React from 'react';
55
import { RouteComponentProps } from 'react-router-dom';
66
import { StackManager } from './StackManager';
7-
import { generateUniqueId } from '../utils';
7+
import { generateId } from '../utils';
88
import { LocationHistory } from '../utils/LocationHistory'
99
import { ViewItem } from './ViewItem';
1010
import { ViewStack } from './ViewStacks';
@@ -44,7 +44,7 @@ export class NavManager extends React.Component<NavManagerProps, NavManagerState
4444

4545
this.locationHistory.add({
4646
hash: window.location.hash,
47-
key: generateUniqueId(6),
47+
key: generateId(),
4848
pathname: window.location.pathname,
4949
search: window.location.search,
5050
state: {}

packages/react-router/src/ReactRouter/Router.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { RouterDirection } from '@ionic/react';
33
import { Action as HistoryAction, Location as HistoryLocation, UnregisterCallback } from 'history';
44
import React from 'react';
55
import { BrowserRouter, BrowserRouterProps, matchPath, RouteComponentProps, withRouter } from 'react-router-dom';
6-
import { generateUniqueId } from '../utils';
6+
import { generateId } from '../utils';
77
import { IonRouteData } from './IonRouteData';
88
import { NavManager } from './NavManager';
99
import { RouteManagerContext, RouteManagerContextState } from './RouteManagerContext';
@@ -49,7 +49,8 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
4949
view.show = false;
5050
view.ionPageElement = undefined;
5151
view.isIonRoute = false;
52-
view.key = generateUniqueId();
52+
view.prevId = undefined;
53+
view.key = generateId();
5354
this.setState({
5455
viewStacks
5556
});
@@ -76,10 +77,6 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
7677
}
7778
leavingView = viewStacks.findViewInfoById(this.activeIonPageId).view;
7879

79-
if (leavingView && leavingView.routeData.match!.url === location.pathname) {
80-
return;
81-
}
82-
8380
if (enteringView) {
8481

8582
if (enteringView.isIonRoute) {
@@ -96,7 +93,7 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
9693
* If the page is being pushed into the stack by another view,
9794
* record the view that originally directed to the new view for back button purposes.
9895
*/
99-
enteringView.prevId = leavingView.id;
96+
enteringView.prevId = enteringView.prevId || leavingView.id;
10097
} else {
10198
direction = direction || 'back';
10299
leavingView.mount = false;
@@ -159,8 +156,8 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
159156
await this.registerViewStack(id, activeId, views, routerOutlet, this.props.location);
160157

161158
function createViewItem(child: React.ReactElement<any>, location: HistoryLocation) {
162-
const viewId = generateUniqueId();
163-
const key = generateUniqueId();
159+
const viewId = generateId();
160+
const key = generateId();
164161
const route = child;
165162
const matchProps = {
166163
exact: child.props.exact,
@@ -182,7 +179,7 @@ class RouteManager extends React.Component<RouteManagerProps, RouteManagerState>
182179
};
183180
if (!!match && view.isIonRoute) {
184181
activeId = viewId;
185-
};
182+
}
186183
return view;
187184
}
188185
}

packages/react-router/src/ReactRouter/StackManager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { generateUniqueId, isDevMode } from '../utils';
2+
import { generateId, isDevMode } from '../utils';
33
import { View } from './View';
44
import { ViewTransitionManager } from './ViewTransitionManager';
55
import { RouteManagerContext } from './RouteManagerContext';
@@ -18,7 +18,7 @@ export class StackManager extends React.Component<StackManagerProps, StackManage
1818

1919
constructor(props: StackManagerProps) {
2020
super(props);
21-
this.id = this.props.id || generateUniqueId();
21+
this.id = this.props.id || generateId();
2222
this.handleViewSync = this.handleViewSync.bind(this);
2323
this.handleHideView = this.handleHideView.bind(this);
2424
}

packages/react-router/src/utils/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const isDevMode = () => {
33
};
44

55
export const deprecationWarning = (message: string) => {
6-
if(isDevMode()) {
6+
if (isDevMode()) {
77
console.warn(message);
88
}
99
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let count = 0;
2+
3+
export const generateId = () => (count++).toString();

packages/react-router/src/utils/generateUniqueId.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export * from './generateUniqueId';
1+
export * from './generateId';
22
export * from './dev';

packages/react/CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
# [4.10.0-rc3]
12

2-
# [4.8.0-rc2]
3+
## Bug fixes
4+
5+
Pages should maintain their original previous page id [2afcb6](https://github.com/ionic-team/ionic/commit/2afcb6c80b167b95beb79641504d9237b498dbef), fixes [#19351](https://github.com/ionic-team/ionic/issues/19351)
6+
7+
Dismiss overlay component on unmount, [3c2694](https://github.com/ionic-team/ionic/commit/3c26946d47b37d42dfaa3294cfb6bf8f0ef11aa4), fixes [#19377](https://github.com/ionic-team/ionic/issues/19377)
8+
9+
Render first route even if url is same, fixes [#19392](https://github.com/ionic-team/ionic/issues/19392)
10+
11+
## Breaking Changes
12+
13+
### Components with href attributes and the new routerLink prop
14+
As of RC3, components that use the href prop (`IonButton`, `IonItem`, etc..), no longer run these links through the router. As a result, page transitions are no longer applied to these links. To maintain page transitions, use the new `routerLink` prop instead. The href prop should be used when you want to enforce a full browser transition on the page, or when you need to link to an external resource.
15+
16+
# [4.9.0-rc2]
317

418
## Features
519

packages/react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ionic/react",
3-
"version": "4.9.0-rc.2",
3+
"version": "4.10.0-rc.3",
44
"description": "React specific wrapper for @ionic/core",
55
"keywords": [
66
"ionic",
@@ -38,7 +38,7 @@
3838
"css/"
3939
],
4040
"dependencies": {
41-
"@ionic/core": "^4.9.0",
41+
"@ionic/core": "^4.10.0",
4242
"tslib": "*"
4343
},
4444
"peerDependencies": {

0 commit comments

Comments
 (0)