Fix embedded bindings (#5244)
This commit is contained in:
parent
0f2c43f19a
commit
64ccb58684
2 changed files with 17 additions and 4 deletions
|
|
@ -32,6 +32,9 @@ export default class ButtonBinding extends PureComponent<Props> {
|
|||
static contextTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
private mounted = false;
|
||||
|
||||
handleActionPress = preventDoubleTap(async () => {
|
||||
const ephemeral = (message: string) => this.props.actions.sendEphemeralPost(message, this.props.post.channel_id, this.props.post.root_id);
|
||||
|
||||
|
|
@ -66,7 +69,9 @@ export default class ButtonBinding extends PureComponent<Props> {
|
|||
);
|
||||
this.setState({executing: true});
|
||||
const res = await this.props.actions.doAppCall(call, AppCallTypes.SUBMIT, this.context.intl);
|
||||
this.setState({executing: false});
|
||||
if (this.mounted) {
|
||||
this.setState({executing: false});
|
||||
}
|
||||
|
||||
if (res.error) {
|
||||
const errorResponse = res.error;
|
||||
|
|
@ -104,6 +109,14 @@ export default class ButtonBinding extends PureComponent<Props> {
|
|||
}
|
||||
}, 4000);
|
||||
|
||||
componentDidMount() {
|
||||
this.mounted = true;
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.mounted = false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {theme, binding} = this.props;
|
||||
const style = getStyleSheet(theme);
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ export default class PostBodyAdditionalContent extends ImageViewPort {
|
|||
if (app_bindings && app_bindings.length) {
|
||||
return (
|
||||
<EmbeddedBindings
|
||||
embed={app_bindings}
|
||||
embeds={app_bindings}
|
||||
baseTextStyle={baseTextStyle}
|
||||
blockStyles={blockStyles}
|
||||
deviceHeight={deviceHeight}
|
||||
|
|
@ -532,13 +532,13 @@ export default class PostBodyAdditionalContent extends ImageViewPort {
|
|||
|
||||
render() {
|
||||
let {link} = this.props;
|
||||
const {openGraphData, postProps, expandedLink} = this.props;
|
||||
const {openGraphData, postProps, expandedLink, appsEnabled} = this.props;
|
||||
const {linkLoadError} = this.state;
|
||||
if (expandedLink) {
|
||||
link = expandedLink;
|
||||
}
|
||||
|
||||
const {attachments, app_bindings, appsEnabled} = postProps;
|
||||
const {attachments, app_bindings} = postProps;
|
||||
|
||||
if (!link && !attachments && !(appsEnabled && app_bindings)) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue