(see https://react.dev/blog/2022/03/08/react-18-upgrade-guide#automatic-batching)
}
};
- handlePersonalAccessTokenCreate = async () => {
- this.setState({ showPersonalAccessTokenForm: false });
+ handlePersonalAccessTokenCreate = () => {
this.cleanUrl();
- await this.fetchData();
+
+ this.setState({ showPersonalAccessTokenForm: false }, () => {
+ this.fetchData();
+ });
};
onSelectedAlmInstanceChange = (instance: AlmSettingsInstance) => {
}
}
- handlePersonalAccessTokenCreated = async () => {
- this.setState({ showPersonalAccessTokenForm: false });
+ handlePersonalAccessTokenCreated = () => {
this.cleanUrl();
- this.setState({ loading: true });
- await this.fetchData();
- this.setState({ loading: false });
+
+ this.setState({ loading: true, showPersonalAccessTokenForm: false }, () => {
+ this.fetchData()
+ .then(() => this.setState({ loading: false }))
+ .catch(() => {
+ /* noop */
+ });
+ });
};
cleanUrl = () => {
router.replace(location);
};
- handlePersonalAccessTokenCreated = async () => {
- this.setState({ showPersonalAccessTokenForm: false });
+ handlePersonalAccessTokenCreated = () => {
this.cleanUrl();
- await this.fetchInitialData();
+
+ this.setState({ showPersonalAccessTokenForm: false }, () => {
+ this.fetchInitialData();
+ });
};
handleImportRepository = (selectedRepository: BitbucketRepository) => {
router.replace(location);
};
- handlePersonalAccessTokenCreated = async () => {
- this.setState({ showPersonalAccessTokenForm: false, resetPat: false });
+ handlePersonalAccessTokenCreated = () => {
this.cleanUrl();
- await this.fetchInitialData();
+ this.setState({ showPersonalAccessTokenForm: false, resetPat: false }, () => {
+ this.fetchInitialData();
+ });
};
onSelectedAlmInstanceChange = (instance: AlmSettingsInstance) => {
import * as React from 'react';
import { translate } from '../../helpers/l10n';
import CopyIcon from '../icons/CopyIcon';
-import { Button, ButtonIcon } from './buttons';
import Tooltip from './Tooltip';
+import { Button, ButtonIcon } from './buttons';
export interface State {
copySuccess: boolean;
handleSuccessCopy = () => {
if (this.mounted) {
- this.setState({ copySuccess: true });
- if (this.copyButton) {
- this.copyButton.focus();
- }
- setTimeout(() => {
- if (this.mounted) {
- this.setState({ copySuccess: false });
+ this.setState({ copySuccess: true }, () => {
+ if (this.copyButton) {
+ this.copyButton.focus();
}
- }, 1000);
+ setTimeout(() => {
+ if (this.mounted) {
+ this.setState({ copySuccess: false });
+ }
+ }, 1000);
+ });
}
};