Add 500ms delay to show membershipBusy
for longer
to avoid a UI that flashes quickly
This commit is contained in:
parent
f2e60b1526
commit
b0818df329
1 changed files with 19 additions and 4 deletions
|
@ -671,8 +671,12 @@ export default React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAcceptInviteClick: function() {
|
_onAcceptInviteClick: async function() {
|
||||||
this.setState({membershipBusy: true});
|
this.setState({membershipBusy: true});
|
||||||
|
|
||||||
|
// Wait 500ms to prevent flashing
|
||||||
|
await Promise.delay(500);
|
||||||
|
|
||||||
this._groupStore.acceptGroupInvite().then(() => {
|
this._groupStore.acceptGroupInvite().then(() => {
|
||||||
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
@ -685,8 +689,12 @@ export default React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onRejectInviteClick: function() {
|
_onRejectInviteClick: async function() {
|
||||||
this.setState({membershipBusy: true});
|
this.setState({membershipBusy: true});
|
||||||
|
|
||||||
|
// Wait 500ms to prevent flashing
|
||||||
|
await Promise.delay(500);
|
||||||
|
|
||||||
this._groupStore.leaveGroup().then(() => {
|
this._groupStore.leaveGroup().then(() => {
|
||||||
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
@ -699,9 +707,12 @@ export default React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onJoinClick: function() {
|
_onJoinClick: async function() {
|
||||||
this.setState({membershipBusy: true});
|
this.setState({membershipBusy: true});
|
||||||
|
|
||||||
|
// Wait 500ms to prevent flashing
|
||||||
|
await Promise.delay(500);
|
||||||
|
|
||||||
this._groupStore.joinGroup().then(() => {
|
this._groupStore.joinGroup().then(() => {
|
||||||
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
@ -721,10 +732,14 @@ export default React.createClass({
|
||||||
description: _t("Leave %(groupName)s?", {groupName: this.props.groupId}),
|
description: _t("Leave %(groupName)s?", {groupName: this.props.groupId}),
|
||||||
button: _t("Leave"),
|
button: _t("Leave"),
|
||||||
danger: true,
|
danger: true,
|
||||||
onFinished: (confirmed) => {
|
onFinished: async (confirmed) => {
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
|
|
||||||
this.setState({membershipBusy: true});
|
this.setState({membershipBusy: true});
|
||||||
|
|
||||||
|
// Wait 500ms to prevent flashing
|
||||||
|
await Promise.delay(500);
|
||||||
|
|
||||||
this._groupStore.leaveGroup().then(() => {
|
this._groupStore.leaveGroup().then(() => {
|
||||||
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
// don't reset membershipBusy here: wait for the membership change to come down the sync
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
|
Loading…
Reference in a new issue