Modal: remove support for onFinished callback (#29852)
* Fix up type for `finished` result of Modal The `finished` promise can be called with an empty array, for example if the dialog is closed by a background click. This was not correctly represented in the typing. Fix that, and add some documentation while we're at it. * Type fixes to onFinished callbacks from Modal These can all be called with zero arguments, despite what the type annotations may say, so mark them accordingly. * Remove uses of Modal `onFinished` property ... because it is confusing. Instead, use the `finished` promise returned by `createDialog`. * Modal: remove support for now-unused `onFinished` prop * StopGapWidgetDriver: use `await` instead of promise chaining * Fix up unit tests
This commit is contained in:
@@ -90,14 +90,15 @@ export default class SetupEncryptionBody extends React.Component<IProps, IState>
|
||||
// We need to call onFinished now to close this dialog, and
|
||||
// again later to signal that the verification is complete.
|
||||
this.props.onFinished();
|
||||
Modal.createDialog(VerificationRequestDialog, {
|
||||
const { finished: verificationFinished } = Modal.createDialog(VerificationRequestDialog, {
|
||||
verificationRequestPromise: requestPromise,
|
||||
member: cli.getUser(userId) ?? undefined,
|
||||
onFinished: async (): Promise<void> => {
|
||||
const request = await requestPromise;
|
||||
request.cancel();
|
||||
this.props.onFinished();
|
||||
},
|
||||
});
|
||||
|
||||
verificationFinished.then(async () => {
|
||||
const request = await requestPromise;
|
||||
request.cancel();
|
||||
this.props.onFinished();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user