diff --git a/app/src/components/Post.js b/app/src/components/Post.js
index 559313f..37e0521 100644
--- a/app/src/components/Post.js
+++ b/app/src/components/Post.js
@@ -127,7 +127,7 @@ class Post extends Component {
primaryColor="#b2e8e6" secondaryColor="#00b5ad" >
- : 'Subject:' + this.state.postSubject
+ : 'Subject: ' + this.state.postSubject
}
diff --git a/app/src/components/PostList.js b/app/src/components/PostList.js
index 2ecc9aa..2742200 100644
--- a/app/src/components/PostList.js
+++ b/app/src/components/PostList.js
@@ -12,24 +12,37 @@ class PostList extends Component {
super(props);
this.getBlockchainData = this.getBlockchainData.bind(this);
- this.dataKeys = [];
+
+ this.state = {
+ dataKeys: []
+ }
}
getBlockchainData(){
if (this.props.drizzleStatus['initialized']){
+ let dataKeysShallowCopy = this.state.dataKeys.slice();
+ let fetchingNewData = false;
+
this.props.postIDs.forEach( postID => {
- if (!this.dataKeys[postID]) {
- this.dataKeys[postID] = drizzle.contracts[contract].methods[getPostMethod].cacheCall(postID);
+ if (!this.state.dataKeys[postID]) {
+ dataKeysShallowCopy[postID] = drizzle.contracts[contract].methods[getPostMethod].cacheCall(postID);
+ fetchingNewData = true;
}
})
+
+ if (fetchingNewData){
+ this.setState({
+ dataKeys: dataKeysShallowCopy
+ });
+ }
}
}
render() {
const posts = this.props.postIDs.map((postID, index) => {
return ( {
- if (!this.dataKeys[topicID]) {
- this.dataKeys[topicID] = drizzle.contracts[contract].methods[getTopicMethod].cacheCall(topicID);
+ if (!this.state.dataKeys[topicID]) {
+ dataKeysShallowCopy[topicID] = drizzle.contracts[contract].methods[getTopicMethod].cacheCall(topicID);
+ fetchingNewData = true;
}
})
+
+ if (fetchingNewData){
+ this.setState({
+ dataKeys: dataKeysShallowCopy
+ });
+ }
}
}
render() {
- const topics = this.props.topicIDs.map((topicID) => {
+ const topics = this.props.topicIDs.map( topicID => {
return ()
diff --git a/app/src/containers/TransactionsMonitorContainer.js b/app/src/containers/TransactionsMonitorContainer.js
index f8152f8..c4ce717 100644
--- a/app/src/containers/TransactionsMonitorContainer.js
+++ b/app/src/containers/TransactionsMonitorContainer.js
@@ -39,6 +39,14 @@ class RightSideBar extends Component {
);
this.handleMessageDismiss(null, index);
break;
+ case 'PostCreated':
+ this.props.history.push("/topic/" +
+ this.props.transactions[transactionHash].receipt.events.PostCreated.returnValues.topicID +
+ "/" +
+ this.props.transactions[transactionHash].receipt.events.PostCreated.returnValues.postID
+ );
+ this.handleMessageDismiss(null, index);
+ break;
default:
this.handleMessageDismiss(null, index);
break;