Skip to content

Commit 402d0b8

Browse files
chore: fix incorrect or missing 'await' usages
1 parent 36c9eba commit 402d0b8

File tree

11 files changed

+25
-25
lines changed

11 files changed

+25
-25
lines changed

plugins/course-apps/live/Settings.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const LiveSettings = ({
7171
};
7272

7373
const handleSettingsSave = async (values) => {
74-
await dispatch(saveLiveConfiguration(courseId, values, navigate));
74+
dispatch(saveLiveConfiguration(courseId, values, navigate));
7575
};
7676

7777
useEffect(() => {

plugins/course-apps/ora_settings/Settings.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const ORASettings = ({ onClose }) => {
4848
event.preventDefault();
4949

5050
success = success && await handleSettingsSave(formValues);
51-
await setSaveError(!success);
51+
setSaveError(!success);
5252
if ((initialFormValues.enableFlexiblePeerGrade !== formValues.enableFlexiblePeerGrade) && success) {
5353
success = await dispatch(updateModel({
5454
modelType: 'courseApps',

plugins/course-apps/ora_settings/Settings.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('ORASettings', () => {
128128
await mockStore({ apiStatus: 200, enabled: true });
129129
renderComponent();
130130

131-
const checkbox = await screen.getByRole('checkbox', { name: /Flex Peer Grading/ });
131+
const checkbox = screen.getByRole('checkbox', { name: /Flex Peer Grading/ });
132132
expect(checkbox).toBeChecked();
133133

134134
await waitFor(() => {

plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ const SettingsModal = ({
238238
const values = { ...rest, enabled: enabled ? checked === 'true' : undefined };
239239

240240
if (enabled) {
241-
success = await dispatch(updateXpertSettings(courseId, values));
241+
success = dispatch(updateXpertSettings(courseId, values));
242242
} else {
243-
success = await dispatch(removeXpertSettings(courseId));
243+
success = dispatch(removeXpertSettings(courseId));
244244
}
245245

246246
if (onSettingsSave) {

src/certificates/certificates-list/hooks/useCertificatesList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const useCertificatesList = (courseId) => {
2525
}));
2626

2727
const handleSubmit = async (values) => {
28-
await dispatch(updateCourseCertificate(courseId, values));
28+
dispatch(updateCourseCertificate(courseId, values));
2929
setEditModes({});
3030
dispatch(setMode(MODE_STATES.view));
3131
};

src/course-checklist/CourseChecklist.test.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ describe('CourseChecklistPage', () => {
6060
});
6161
describe('renders', () => {
6262
describe('if enable_quality prop is true', () => {
63-
it('two checklist components ', () => {
63+
it('two checklist components ', async () => {
6464
renderComponent();
65-
mockStore(200);
65+
await mockStore(200);
6666

6767
expect(screen.getByText(messages.launchChecklistLabel.defaultMessage)).toBeVisible();
6868

@@ -81,7 +81,7 @@ describe('CourseChecklistPage', () => {
8181

8282
it('correct content when the launch checklist has loaded', async () => {
8383
renderComponent();
84-
mockStore(404);
84+
await mockStore(404);
8585
await waitFor(() => {
8686
const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus;
8787

@@ -93,7 +93,7 @@ describe('CourseChecklistPage', () => {
9393

9494
it('correct content when the best practices checklist is loading', async () => {
9595
renderComponent();
96-
mockStore(404);
96+
await mockStore(404);
9797
await waitFor(() => {
9898
const { bestPracticeChecklistStatus } = store.getState().courseChecklist.loadingStatus;
9999

@@ -114,9 +114,9 @@ describe('CourseChecklistPage', () => {
114114
});
115115
});
116116

117-
it('one checklist components ', () => {
117+
it('one checklist components ', async () => {
118118
renderComponent();
119-
mockStore(200);
119+
await mockStore(200);
120120

121121
expect(screen.getByText(messages.launchChecklistLabel.defaultMessage)).toBeVisible();
122122

@@ -126,7 +126,7 @@ describe('CourseChecklistPage', () => {
126126
describe('an aria-live region with', () => {
127127
it('correct content when the launch checklist has loaded', async () => {
128128
renderComponent();
129-
mockStore(404);
129+
await mockStore(404);
130130
await waitFor(() => {
131131
const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus;
132132

@@ -138,7 +138,7 @@ describe('CourseChecklistPage', () => {
138138

139139
it('correct content when the best practices checklist is loading', async () => {
140140
renderComponent();
141-
mockStore(404);
141+
await mockStore(404);
142142
await waitFor(() => {
143143
const { bestPracticeChecklistStatus } = store.getState().courseChecklist.loadingStatus;
144144

src/course-unit/CourseUnit.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ describe('<CourseUnit />', () => {
838838
});
839839
render(<RootWrapper />);
840840
// to wait for loading
841-
screen.findByTestId('unit-header-title');
841+
await screen.findByTestId('unit-header-title');
842842
// The new unit button should not be visible when childAddable is false
843843
expect(
844844
screen.queryByRole('button', { name: courseSequenceMessages.newUnitBtnText.defaultMessage }),

src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ export const ItemHierarchyPublisher = ({
123123
{intl.formatMessage(messages.publishCancel)}
124124
</Button>
125125
<LoadingButton
126-
onClick={async (e) => {
126+
onClick={(e) => {
127127
e.preventDefault();
128128
e.stopPropagation();
129-
await handlePublish();
129+
handlePublish();
130130
}}
131131
variant="primary rounded-0"
132132
label={intl.formatMessage(messages.publishConfirm)}

src/optimizer-page/scan-results/ScanResults.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ const ScanResults: FC<Props> = ({
460460
const handleUpdateCompletion = async () => {
461461
if (rerunLinkUpdateInProgress === false && isUpdateAllInProgress) {
462462
try {
463-
const updateStatusResponse = await dispatch(fetchRerunLinkUpdateStatus(courseId)) as any;
463+
const updateStatusResponse = dispatch(fetchRerunLinkUpdateStatus(courseId)) as any;
464464

465465
if (!updateStatusResponse) {
466466
setIsUpdateAllInProgress(false);
@@ -590,14 +590,14 @@ const ScanResults: FC<Props> = ({
590590
try {
591591
setUpdatingLinkIds(prev => ({ ...prev, [uniqueId]: true }));
592592
const contentType = getContentType(sectionId || '');
593-
await dispatch(updateSinglePreviousRunLink(courseId, link, blockId, contentType));
593+
dispatch(updateSinglePreviousRunLink(courseId, link, blockId, contentType));
594594

595595
const pollForSingleLinkResult = async (attempts = 0): Promise<boolean> => {
596596
if (attempts > 30) { // Max 30 attempts (60 seconds)
597597
throw new Error('Timeout waiting for link update result');
598598
}
599599

600-
const updateStatusResponse = await dispatch(fetchRerunLinkUpdateStatus(courseId)) as any;
600+
const updateStatusResponse = dispatch(fetchRerunLinkUpdateStatus(courseId)) as any;
601601
const pollStatus = updateStatusResponse?.status || updateStatusResponse?.updateStatus;
602602

603603
if (!updateStatusResponse || RERUN_LINK_UPDATE_IN_PROGRESS_STATUSES.includes(pollStatus)) {
@@ -755,7 +755,7 @@ const ScanResults: FC<Props> = ({
755755
try {
756756
setProcessedResponseIds(new Set());
757757
setIsUpdateAllInProgress(true);
758-
await dispatch(updateAllPreviousRunLinks(courseId));
758+
dispatch(updateAllPreviousRunLinks(courseId));
759759

760760
return true;
761761
} catch (error) {

src/pages-and-resources/app-settings-modal/AppSettingsModal.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ const AppSettingsModal = ({
7272
const handleFormSubmit = async (values) => {
7373
let success = true;
7474
if (appInfo.enabled !== values.enabled) {
75-
success = await dispatch(updateAppStatus(courseId, appInfo.id, values.enabled));
75+
success = dispatch(updateAppStatus(courseId, appInfo.id, values.enabled));
7676
}
7777
// Call the submit handler for the settings component to save its settings
7878
if (onSettingsSave) {
7979
success = success && await onSettingsSave(values);
8080
}
81-
await setSaveError(!success);
81+
setSaveError(!success);
8282
!success && alertRef?.current.scrollIntoView(); // eslint-disable-line @typescript-eslint/no-unused-expressions
8383
};
8484

8585
const handleFormikSubmit = ({ handleSubmit, errors }) => async (event) => {
8686
// If submitting the form with errors, show the alert and scroll to it.
8787
await handleSubmit(event);
8888
if (Object.keys(errors).length > 0) {
89-
await setSaveError(true);
89+
setSaveError(true);
9090
alertRef?.current.scrollIntoView?.(); // eslint-disable-line no-unused-expressions
9191
}
9292
};

0 commit comments

Comments
 (0)