Skip to content
This repository was archived by the owner on Jun 2, 2024. It is now read-only.

Commit d854ca3

Browse files
committed
fix: remove async/await to reduce bundle size
1 parent 9fcf592 commit d854ca3

File tree

6 files changed

+19
-25
lines changed

6 files changed

+19
-25
lines changed

docs/build/1.7ca52cd9.js renamed to docs/build/1.612a4b41.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/build/bundle.5d7edf65.js renamed to docs/build/bundle.b3b4f771.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>react-semantic-render</title></head><body><div id="rsg-root"></div><script src="build/bundle.5d7edf65.js"></script></body></html>
1+
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>react-semantic-render</title></head><body><div id="rsg-root"></div><script src="build/bundle.b3b4f771.js"></script></body></html>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-semantic-render",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Semantic helper components for rendering content with React.",
55
"author": "Christian Svenkerud",
66
"contributors": [

src/components/ShowAsync/ShowAsync.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export class ShowAsync extends React.Component<IShowAsyncProps, IShowAsyncState>
4747
// Initialize state
4848
public readonly state: IShowAsyncState = initialState;
4949

50-
public async componentDidMount() {
50+
public componentDidMount() {
5151
// Start handling the promise, must happen after mount as setState is called when promise is handled
52-
await this.handlePromise(this.props.when);
52+
this.handlePromise(this.props.when);
5353
}
5454

5555
public render() {
@@ -85,24 +85,18 @@ export class ShowAsync extends React.Component<IShowAsyncProps, IShowAsyncState>
8585
return null;
8686
}
8787

88-
private setStateAsync(state: any) {
89-
return new Promise(resolve => {
90-
this.setState(state, resolve);
91-
});
92-
}
93-
9488
// Promise resolver function
95-
private async handlePromise(promise: Promise<any>) {
96-
await this.setStateAsync({ status: statusTypes.pending });
97-
await promise
89+
private handlePromise(promise: Promise<any>) {
90+
this.setState({ status: statusTypes.pending });
91+
promise
9892
.then(success => {
99-
this.setStateAsync({
93+
this.setState({
10094
status: statusTypes.resolved,
10195
value: success,
10296
});
10397
})
10498
.catch(reason => {
105-
this.setStateAsync({
99+
this.setState({
106100
status: statusTypes.rejected,
107101
value: reason,
108102
});

0 commit comments

Comments
 (0)