You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
Prevent state to be toggled whilst a request is pending
This commit is contained in:
@ -886,19 +886,21 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
|||||||
};
|
};
|
||||||
|
|
||||||
_toggleMember = (member: Member) => {
|
_toggleMember = (member: Member) => {
|
||||||
let filterText = this.state.filterText;
|
if (!this.state.busy) {
|
||||||
const targets = this.state.targets.map(t => t); // cheap clone for mutation
|
let filterText = this.state.filterText;
|
||||||
const idx = targets.indexOf(member);
|
const targets = this.state.targets.map(t => t); // cheap clone for mutation
|
||||||
if (idx >= 0) {
|
const idx = targets.indexOf(member);
|
||||||
targets.splice(idx, 1);
|
if (idx >= 0) {
|
||||||
} else {
|
targets.splice(idx, 1);
|
||||||
targets.push(member);
|
} else {
|
||||||
filterText = ""; // clear the filter when the user accepts a suggestion
|
targets.push(member);
|
||||||
}
|
filterText = ""; // clear the filter when the user accepts a suggestion
|
||||||
this.setState({targets, filterText});
|
}
|
||||||
|
this.setState({targets, filterText});
|
||||||
|
|
||||||
if (this._editorRef && this._editorRef.current) {
|
if (this._editorRef && this._editorRef.current) {
|
||||||
this._editorRef.current.focus();
|
this._editorRef.current.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user