Skip to content

Commit 52c315a

Browse files
refactor: remove unnecessary async/await expressions (#1873)
1 parent 53e4465 commit 52c315a

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class BrowserCell extends Component {
3030
};
3131
}
3232

33-
async renderCellContent() {
33+
renderCellContent() {
3434
let content = this.props.value;
3535
let isNewRow = this.props.row < 0;
3636
this.copyableValue = content;
@@ -53,7 +53,7 @@ export default class BrowserCell extends Component {
5353
content = <span>&nbsp;</span>;
5454
classes.push(styles.empty);
5555
} else if (this.props.type === 'Pointer') {
56-
const defaultPointerKey = await ColumnPreferences.getPointerDefaultKey(this.props.appId, this.props.value.className);
56+
const defaultPointerKey = ColumnPreferences.getPointerDefaultKey(this.props.appId, this.props.value.className);
5757
let dataValue = this.props.value.id;
5858
if( defaultPointerKey !== 'objectId' ) {
5959
dataValue = this.props.value.get(defaultPointerKey);
@@ -175,9 +175,9 @@ export default class BrowserCell extends Component {
175175
this.setState({ ...this.state, content, classes })
176176
}
177177

178-
async componentDidUpdate(prevProps) {
178+
componentDidUpdate(prevProps) {
179179
if ( this.props.value !== prevProps.value ) {
180-
await this.renderCellContent();
180+
this.renderCellContent();
181181
}
182182
if (this.props.current) {
183183
const node = this.cellRef.current;

src/dashboard/Data/Browser/AddColumnDialog.react.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default class AddColumnDialog extends React.Component {
149149
} catch (e) {
150150
isDefaultValueValid = defaultValue === ''
151151
}
152-
return await this.setState({ defaultValue: formattedValue, isDefaultValueValid })
152+
return this.setState({ defaultValue: formattedValue, isDefaultValueValid })
153153
}
154154

155155
renderDefaultValueInput() {

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class Browser extends DashboardView {
193193
const parent = await parentObjectQuery.get(entityId, { useMasterKey });
194194
relation = parent.relation(relationName);
195195
}
196-
await this.setState({
196+
this.setState({
197197
data: null,
198198
newObject: null,
199199
lastMax: -1,
@@ -639,10 +639,10 @@ class Browser extends DashboardView {
639639
editCloneRows: null,
640640
};
641641
if (relation) {
642-
await this.setState(initialState);
643-
await this.setRelation(relation, prevFilters);
642+
this.setState(initialState);
643+
this.setRelation(relation, prevFilters);
644644
} else {
645-
await this.setState({
645+
this.setState({
646646
...initialState,
647647
relation: null,
648648
});
@@ -676,7 +676,7 @@ class Browser extends DashboardView {
676676
uniqueField = field;
677677
}
678678
});
679-
await this.setState({ isUnique, uniqueField });
679+
this.setState({ isUnique, uniqueField });
680680

681681
const data = await promise;
682682
return data;
@@ -718,7 +718,7 @@ class Browser extends DashboardView {
718718
async fetchRelation(relation, filters = new List()) {
719719
const data = await this.fetchParseData(relation, filters);
720720
const relationCount = await this.fetchRelationCount(relation);
721-
await this.setState({
721+
this.setState({
722722
relation,
723723
relationCount,
724724
selection: {},

src/dashboard/Data/Browser/ObjectPickerDialog.react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export default class ObjectPickerDialog extends React.Component {
188188
async updateFilters(filters) {
189189
const { selection } = this.state;
190190
const { className } = this.props;
191-
await this.setState({
191+
this.setState({
192192
filters: filters,
193193
selection: {}
194194
});
@@ -199,7 +199,7 @@ export default class ObjectPickerDialog extends React.Component {
199199
async updateOrdering(ordering) {
200200
const { className } = this.props;
201201
const { filters, selection } = this.state;
202-
await this.setState({
202+
this.setState({
203203
ordering: ordering,
204204
selection: {}
205205
});
@@ -215,7 +215,7 @@ export default class ObjectPickerDialog extends React.Component {
215215
async refresh() {
216216
const { className } = this.props;
217217
const { filters, selection } = this.state;
218-
await this.setState({
218+
this.setState({
219219
data: null,
220220
lastMax: -1,
221221
selection: {}

src/dashboard/Data/Browser/PointerKeyDialog.react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export default class PointerKeyDialog extends React.Component {
2323
};
2424
}
2525

26-
async componentDidMount() {
27-
const pointerKey = await ColumnPreferences.getPointerDefaultKey(this.props.app.applicationId, this.props.className);
26+
componentDidMount() {
27+
const pointerKey = ColumnPreferences.getPointerDefaultKey(this.props.app.applicationId, this.props.className);
2828
this.setState({ name: pointerKey });
2929
}
3030

src/lib/ColumnPreferences.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ export function setPointerDefaultKey( appId, className, name ) {
145145
localStorage.removeItem(className);
146146
}
147147

148-
export async function getPointerDefaultKey( appId, className ) {
149-
let pointerKey = await localStorage.getItem(pointerKeyPath(appId, className));
148+
export function getPointerDefaultKey( appId, className ) {
149+
let pointerKey = localStorage.getItem(pointerKeyPath(appId, className));
150150
if ( !pointerKey ) {
151151
// old pointer key.
152-
pointerKey = await localStorage.getItem(className) || 'objectId';
152+
pointerKey = localStorage.getItem(className) || 'objectId';
153153
}
154154
return pointerKey;
155155
}

0 commit comments

Comments
 (0)