Even less history passing, fix global styles warning in dev

This commit is contained in:
Tom Moor
2019-01-19 00:44:16 -08:00
parent 13501b6d76
commit 77a8f54973
6 changed files with 23 additions and 36 deletions

View File

@@ -3,6 +3,7 @@ import * as React from 'react';
import { throttle } from 'lodash';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import { Redirect } from 'react-router-dom';
import styled from 'styled-components';
import breakpoint from 'styled-components-breakpoint';
import { NewDocumentIcon } from 'outline-icons';
@@ -33,7 +34,6 @@ type Props = {
publish?: boolean,
autosave?: boolean,
}) => *,
history: Object,
auth: AuthStore,
};
@@ -41,6 +41,7 @@ type Props = {
class Header extends React.Component<Props> {
@observable isScrolled = false;
@observable showShareModal = false;
@observable redirectTo: ?string;
componentDidMount() {
window.addEventListener('scroll', this.handleScroll);
@@ -57,7 +58,7 @@ class Header extends React.Component<Props> {
handleScroll = throttle(this.updateIsScrolled, 50);
handleEdit = () => {
this.props.history.push(documentEditUrl(this.props.document));
this.redirectTo = documentEditUrl(this.props.document);
};
handleSave = () => {
@@ -86,6 +87,8 @@ class Header extends React.Component<Props> {
};
render() {
if (this.redirectTo) return <Redirect to={this.redirectTo} />;
const {
document,
isEditing,