Skip to content

Commit 739fedf

Browse files
authored
Revert "chore: use promise instead of async await"
1 parent d3efa79 commit 739fedf

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"test:coverage": "tsdx test --coverage",
5656
"lint": "tsdx lint",
5757
"prepare": "tsdx build",
58-
"size": "yarn build && size-limit",
58+
"size": "size-limit",
5959
"analyze": "size-limit --why",
6060
"release": "np"
6161
},

src/wizard.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ const Wizard: React.FC<WizardProps> = React.memo(
3535

3636
const doNextStep = React.useCallback(async () => {
3737
if (hasNextStep.current && nextStepHandler.current) {
38-
setIsLoading(true);
39-
Promise.resolve(nextStepHandler.current)
40-
.then(() => {
41-
setIsLoading(false);
42-
nextStepHandler.current = null;
43-
return goToNextStep();
44-
})
45-
.catch((error) => {
46-
setIsLoading(false);
47-
throw error;
48-
});
38+
try {
39+
setIsLoading(true);
40+
await nextStepHandler.current();
41+
setIsLoading(false);
42+
nextStepHandler.current = null;
43+
goToNextStep();
44+
} catch (error) {
45+
setIsLoading(false);
46+
throw error;
47+
}
4948
} else {
5049
goToNextStep();
5150
}

0 commit comments

Comments
 (0)