summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view/post_attachment.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/post_view/post_attachment.jsx')
-rw-r--r--webapp/components/post_view/post_attachment.jsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/webapp/components/post_view/post_attachment.jsx b/webapp/components/post_view/post_attachment.jsx
index b7bd1ade9..d7b1ee774 100644
--- a/webapp/components/post_view/post_attachment.jsx
+++ b/webapp/components/post_view/post_attachment.jsx
@@ -55,10 +55,11 @@ export default class PostAttachment extends React.PureComponent {
toggleCollapseState(e) {
e.preventDefault();
-
- this.setState({
- text: this.state.collapsed ? this.state.uncollapsedText : this.state.collapsedText,
- collapsed: !this.state.collapsed
+ this.setState((prevState) => {
+ return {
+ text: prevState.collapsed ? prevState.uncollapsedText : prevState.collapsedText,
+ collapsed: !prevState.collapsed
+ };
});
}