From 42c8dab0b7aef4c92d553d970af971e580808a94 Mon Sep 17 00:00:00 2001 From: vbaranov Date: Thu, 11 Jan 2018 18:35:41 +0300 Subject: [PATCH] Console warning on switching to active ballots fix --- src/App.js | 8 ++------ src/components/Ballots.jsx | 7 ++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/App.js b/src/App.js index 2f2dd8a..607e98a 100644 --- a/src/App.js +++ b/src/App.js @@ -10,15 +10,11 @@ import { inject, observer } from 'mobx-react'; @observer class App extends Component { onBallotsRender = () => { - const { commonStore } = this.props; - commonStore.isActiveFilter = false; - return ; + return ; } onActiveBallotsRender = () => { - const { commonStore } = this.props; - commonStore.isActiveFilter = true; - return ; + return ; } onNewBallotRender = () => { diff --git a/src/components/Ballots.jsx b/src/components/Ballots.jsx index 2a38d70..d4af0ed 100644 --- a/src/components/Ballots.jsx +++ b/src/components/Ballots.jsx @@ -2,9 +2,14 @@ import React from 'react'; import { inject, observer } from "mobx-react"; import "babel-polyfill"; -@inject("ballotsStore") +@inject("commonStore", "ballotsStore") @observer export class Ballots extends React.Component { + componentWillMount () { + const { commonStore } = this.props; + commonStore.isActiveFilter = this.props.isActiveFilter; + } + render () { const { ballotsStore } = this.props; return (