Skip to content

Commit a29e45e

Browse files
author
vikasrohit
authored
Merge pull request #600 from appirio-tech/feature/sticky_new_post_after_successful_post
Github issue #596, Status update: a comment post remains in the composer window after being posted
2 parents 9dd0261 + 652884c commit a29e45e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/projects/detail/containers/FeedContainer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ class FeedView extends React.Component {
130130

131131
init(props, prevProps) {
132132
const { feeds } = props
133+
let resetNewPost = false
134+
if (prevProps) {
135+
resetNewPost = prevProps.isCreatingFeed && !props.isCreatingFeed && !props.error
136+
}
133137
this.setState({
138+
newPost: resetNewPost ? {} : this.state.newPost,
134139
feeds: feeds.map((feed) => {
135140
// finds the same feed from previous props, if exists
136141
let prevFeed

src/projects/detail/containers/MessagesContainer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,12 @@ class MessagesView extends React.Component {
145145
const activeThreadIndex = threadId
146146
? _.findIndex(props.threads, (thread) => thread.id === threadId )
147147
: 0
148-
148+
let resetNewPost = false
149+
if (prevProps) {
150+
resetNewPost = prevProps.isCreatingFeed && !props.isCreatingFeed && !props.error
151+
}
149152
this.setState({
153+
newPost: resetNewPost ? {} : this.state.newPost,
150154
scrollPosition: activeThreadIndex * 71,
151155
threads: props.threads.map((thread, idx) => {
152156
// finds the same thread from previous props, if exists

0 commit comments

Comments
 (0)