Pass location to trigger rerender. This is advised by react-router docs

This commit is contained in:
Tom Moor
2017-10-31 18:24:00 -07:00
parent 507251cfe4
commit 79f6d3b3ec
5 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
// @flow
import React from 'react';
import { withRouter } from 'react-router-dom';
import type { Location } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import styled from 'styled-components';
import { observer, inject } from 'mobx-react';
@@ -30,6 +31,7 @@ import DocumentsStore from 'stores/DocumentsStore';
type Props = {
history: Object,
location: Location,
collections: CollectionsStore,
documents: DocumentsStore,
children?: ?React.Element<any>,
@@ -139,6 +141,7 @@ type Props = {
<LinkSection>
<SidebarCollections
history={this.props.history}
location={this.props.location}
activeDocument={documents.active}
onCreateCollection={this.handleCreateCollection}
activeDocumentRef={this.scrollToActiveDocument}

View File

@@ -2,6 +2,7 @@
import React, { Component } from 'react';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import type { Location } from 'react-router-dom';
import Flex from 'shared/components/Flex';
import styled from 'styled-components';
import { color, fontWeight } from 'shared/styles/constants';
@@ -20,6 +21,7 @@ import { type NavigationNode } from 'types';
type Props = {
history: Object,
location: Location,
collections: CollectionsStore,
documents: DocumentsStore,
activeDocument: ?Document,

View File

@@ -2,8 +2,7 @@
import React, { Component } from 'react';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import { Redirect } from 'react-router-dom';
import { Link } from 'react-router-dom';
import { Link, Redirect } from 'react-router-dom';
import styled from 'styled-components';
import { newDocumentUrl } from 'utils/routeHelpers';

View File

@@ -5,6 +5,7 @@ import styled from 'styled-components';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import { withRouter, Prompt } from 'react-router-dom';
import type { Location } from 'react-router-dom';
import keydown from 'react-keydown';
import Flex from 'shared/components/Flex';
import { color, layout } from 'shared/styles/constants';
@@ -42,7 +43,7 @@ Are you sure you want to discard them?
type Props = {
match: Object,
history: Object,
location: Object,
location: Location,
keydown: Object,
documents: DocumentsStore,
collections: CollectionsStore,

View File

@@ -1,6 +1,7 @@
// @flow
import React from 'react';
import { Redirect } from 'react-router-dom';
import type { Location } from 'react-router-dom';
import queryString from 'query-string';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
@@ -11,7 +12,7 @@ import AuthStore from 'stores/AuthStore';
type Props = {
auth: AuthStore,
location: Object,
location: Location,
};
@observer class SlackAuth extends React.Component {