Browse Source

chore: Upgrade React Router to v3 (#6847)

* chore: Upgrade react-router to v3

Required for React 16
Lyn Nagara 7 years ago
parent
commit
7c7f438307

+ 1 - 1
package.json

@@ -72,7 +72,7 @@
     "react-icon-base": "^2.0.4",
     "react-lazy-load": "3.0.10",
     "react-mentions": "^1.0.0",
-    "react-router": "2.8.1",
+    "react-router": "3.2.0",
     "react-sparklines": "1.6.0",
     "react-sticky": "5.0.4",
     "reflux": "0.4.1",

+ 4 - 3
src/sentry/static/sentry/app/components/group/releaseStats.jsx

@@ -47,9 +47,10 @@ const GroupReleaseStats = createReactClass({
     let envList = EnvironmentStore.getAll();
     let queryParams = this.props.location.query;
 
-    let selectedEnvironment = queryParams.hasOwnProperty('environment')
-      ? queryParams.environment
-      : this.props.defaultEnvironment;
+    let selectedEnvironment =
+      'environment' in queryParams
+        ? queryParams.environment
+        : this.props.defaultEnvironment;
 
     if (
       selectedEnvironment &&

+ 2 - 4
src/sentry/static/sentry/app/components/organizationIssueList.jsx

@@ -30,10 +30,8 @@ class OrganizationIssueList extends React.Component {
   }
 
   getQueryStringState = props => {
-    let location = props.location;
-    let status = location.query.hasOwnProperty('status')
-      ? location.query.status
-      : 'unresolved';
+    let query = props.location.query;
+    let status = 'status' in query ? query.status : 'unresolved';
     return {
       status,
     };

+ 2 - 2
src/sentry/static/sentry/app/routes.jsx

@@ -105,10 +105,10 @@ import TeamMembers from './views/teamMembers';
 import TeamSettings from './views/teamSettings';
 import errorHandler from './utils/errorHandler';
 
-function appendTrailingSlash(nextState, replaceState) {
+function appendTrailingSlash(nextState, replace) {
   let lastChar = nextState.location.pathname.slice(-1);
   if (lastChar !== '/') {
-    replaceState(nextState, nextState.location.pathname + '/');
+    replace(nextState.location.pathname + '/');
   }
 }
 

+ 4 - 7
src/sentry/static/sentry/app/views/projectUserReports.jsx

@@ -54,13 +54,10 @@ const ProjectUserReports = createReactClass({
   },
 
   getQueryStringState(props) {
-    let location = props.location;
-    let status = location.query.hasOwnProperty('status')
-      ? location.query.status
-      : this.props.defaultStatus;
-    let query = location.query.hasOwnProperty('query')
-      ? location.query.query
-      : this.props.defaultQuery;
+    let q = props.location.query;
+    let status = 'status' in q ? q.status : this.props.defaultStatus;
+    let query = 'query' in q ? q.query : this.props.defaultQuery;
+
     return {
       query,
       status,

+ 8 - 9
src/sentry/static/sentry/app/views/stream.jsx

@@ -278,17 +278,16 @@ const Stream = createReactClass({
     // state may not yet be defined at this point
     let state = this.state || {};
 
-    let hasQuery = currentQuery.hasOwnProperty('query');
+    let hasQuery = 'query' in currentQuery;
 
     let searchId = hasQuery ? null : props.params.searchId || state.searchId || null;
 
-    let sort = currentQuery.hasOwnProperty('sort')
-      ? currentQuery.sort
-      : this.props.defaultSort;
+    let sort = 'sort' in currentQuery ? currentQuery.sort : this.props.defaultSort;
 
-    let statsPeriod = currentQuery.hasOwnProperty('statsPeriod')
-      ? currentQuery.statsPeriod
-      : this.props.defaultStatsPeriod;
+    let statsPeriod =
+      'statsPeriod' in currentQuery
+        ? currentQuery.statsPeriod
+        : this.props.defaultStatsPeriod;
 
     if (statsPeriod !== '14d' && statsPeriod !== '24h') {
       statsPeriod = this.props.defaultStatsPeriod;
@@ -333,7 +332,7 @@ const Stream = createReactClass({
   hasQuery(props) {
     props = props || this.props;
     let currentQuery = props.location.query || {};
-    return currentQuery.hasOwnProperty('query');
+    return 'query' in currentQuery;
   },
 
   fetchData() {
@@ -356,7 +355,7 @@ const Stream = createReactClass({
     };
 
     let currentQuery = this.props.location.query || {};
-    if (currentQuery.hasOwnProperty('cursor')) {
+    if ('cursor' in currentQuery) {
       requestParams.cursor = currentQuery.cursor;
     }
 

+ 23 - 37
yarn.lock

@@ -2096,11 +2096,7 @@ caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
   version "1.0.30000783"
   resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000783.tgz#16b30d47266a4f515cc69ae0316b670c9603cdbe"
 
-caniuse-lite@^1.0.30000704:
-  version "1.0.30000787"
-  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000787.tgz#a76c4fa1d6ac00640447ec83c1e7c6b33dd615c5"
-
-caniuse-lite@^1.0.30000780, caniuse-lite@^1.0.30000783:
+caniuse-lite@^1.0.30000704, caniuse-lite@^1.0.30000780, caniuse-lite@^1.0.30000783:
   version "1.0.30000783"
   resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000783.tgz#9b5499fb1b503d2345d12aa6b8612852f4276ffd"
 
@@ -2574,17 +2570,17 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
     safe-buffer "^5.0.1"
     sha.js "^2.4.8"
 
-create-react-class@^15.5.2:
-  version "15.6.0"
-  resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.0.tgz#ab448497c26566e1e29413e883207d57cfe7bed4"
+create-react-class@^15.5.1, create-react-class@^15.6.0, create-react-class@^15.6.2:
+  version "15.6.2"
+  resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.2.tgz#cf1ed15f12aad7f14ef5f2dfe05e6c42f91ef02a"
   dependencies:
     fbjs "^0.8.9"
     loose-envify "^1.3.1"
     object-assign "^4.1.1"
 
-create-react-class@^15.6.0, create-react-class@^15.6.2:
-  version "15.6.2"
-  resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.2.tgz#cf1ed15f12aad7f14ef5f2dfe05e6c42f91ef02a"
+create-react-class@^15.5.2:
+  version "15.6.0"
+  resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.0.tgz#ab448497c26566e1e29413e883207d57cfe7bed4"
   dependencies:
     fbjs "^0.8.9"
     loose-envify "^1.3.1"
@@ -3093,19 +3089,13 @@ ee-first@1.1.1:
   version "1.1.1"
   resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
 
-electron-releases@^2.1.0:
-  version "2.1.0"
-  resolved "https://registry.yarnpkg.com/electron-releases/-/electron-releases-2.1.0.tgz#c5614bf811f176ce3c836e368a0625782341fd4e"
-
 electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.28:
   version "1.3.28"
   resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.28.tgz#8dd4e6458086644e9f9f0a1cf32e2a1f9dffd9ee"
 
 electron-to-chromium@^1.3.16:
-  version "1.3.30"
-  resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.30.tgz#9666f532a64586651fc56a72513692e820d06a80"
-  dependencies:
-    electron-releases "^2.1.0"
+  version "1.3.29"
+  resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.29.tgz#7a58236b95468c3e7660091348522d65d7736b36"
 
 elegant-spinner@^1.0.1:
   version "1.0.1"
@@ -4301,14 +4291,14 @@ history@1.13.0:
     qs "^4.0.0"
     warning "^2.0.0"
 
-history@^2.1.2:
-  version "2.1.2"
-  resolved "https://registry.yarnpkg.com/history/-/history-2.1.2.tgz#4aa2de897a0e4867e4539843be6ecdb2986bfdec"
+history@^3.0.0:
+  version "3.3.0"
+  resolved "https://registry.yarnpkg.com/history/-/history-3.3.0.tgz#fcedcce8f12975371545d735461033579a6dae9c"
   dependencies:
-    deep-equal "^1.0.0"
-    invariant "^2.0.0"
-    query-string "^3.0.0"
-    warning "^2.0.0"
+    invariant "^2.2.1"
+    loose-envify "^1.2.0"
+    query-string "^4.2.2"
+    warning "^3.0.0"
 
 hmac-drbg@^1.0.0:
   version "1.0.1"
@@ -7129,13 +7119,7 @@ query-string@2.4.2:
   dependencies:
     strict-uri-encode "^1.0.0"
 
-query-string@^3.0.0:
-  version "3.0.3"
-  resolved "https://registry.yarnpkg.com/query-string/-/query-string-3.0.3.tgz#ae2e14b4d05071d4e9b9eb4873c35b0dcd42e638"
-  dependencies:
-    strict-uri-encode "^1.0.0"
-
-query-string@^4.1.0, query-string@^4.3.2:
+query-string@^4.1.0, query-string@^4.2.2, query-string@^4.3.2:
   version "4.3.4"
   resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb"
   dependencies:
@@ -7423,14 +7407,16 @@ react-proxy@^3.0.0-alpha.0:
   dependencies:
     lodash "^4.6.1"
 
-react-router@2.8.1:
-  version "2.8.1"
-  resolved "https://registry.yarnpkg.com/react-router/-/react-router-2.8.1.tgz#73e9491f6ceb316d0f779829081863e378ee4ed7"
+react-router@3.2.0:
+  version "3.2.0"
+  resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.2.0.tgz#62b6279d589b70b34e265113e4c0a9261a02ed36"
   dependencies:
-    history "^2.1.2"
+    create-react-class "^15.5.1"
+    history "^3.0.0"
     hoist-non-react-statics "^1.2.0"
     invariant "^2.2.1"
     loose-envify "^1.2.0"
+    prop-types "^15.5.6"
     warning "^3.0.0"
 
 react-side-effect@^0.3.2: