You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-13 08:02:38 +03:00
Hide widget panel while it is being deleted.
This commit is contained in:
@@ -46,6 +46,7 @@ export default React.createClass({
|
|||||||
loading: false,
|
loading: false,
|
||||||
widgetUrl: this.props.url,
|
widgetUrl: this.props.url,
|
||||||
error: null,
|
error: null,
|
||||||
|
deleting: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -92,6 +93,7 @@ export default React.createClass({
|
|||||||
|
|
||||||
_onDeleteClick: function() {
|
_onDeleteClick: function() {
|
||||||
console.log("Delete widget %s", this.props.id);
|
console.log("Delete widget %s", this.props.id);
|
||||||
|
this.setState({deleting: true});
|
||||||
MatrixClientPeg.get().sendStateEvent(
|
MatrixClientPeg.get().sendStateEvent(
|
||||||
this.props.room.roomId,
|
this.props.room.roomId,
|
||||||
'im.vector.modular.widgets',
|
'im.vector.modular.widgets',
|
||||||
@@ -101,6 +103,7 @@ export default React.createClass({
|
|||||||
console.log('Deleted widget');
|
console.log('Deleted widget');
|
||||||
}, (e) => {
|
}, (e) => {
|
||||||
console.error('Failed to delete widget', e);
|
console.error('Failed to delete widget', e);
|
||||||
|
this.setState({deleting: false});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -115,6 +118,12 @@ export default React.createClass({
|
|||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
let appTileBody;
|
let appTileBody;
|
||||||
|
|
||||||
|
// Don't render widget if it is in the process of being deleted
|
||||||
|
if (this.state.deleting) {
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
appTileBody = (
|
appTileBody = (
|
||||||
<div> Loading... </div>
|
<div> Loading... </div>
|
||||||
|
|||||||
Reference in New Issue
Block a user