Skip to content

refactor: remove unnecessary async/await expressions #1873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/BrowserCell/BrowserCell.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class BrowserCell extends Component {
};
}

async renderCellContent() {
renderCellContent() {
let content = this.props.value;
let isNewRow = this.props.row < 0;
this.copyableValue = content;
Expand All @@ -53,7 +53,7 @@ export default class BrowserCell extends Component {
content = <span>&nbsp;</span>;
classes.push(styles.empty);
} else if (this.props.type === 'Pointer') {
const defaultPointerKey = await ColumnPreferences.getPointerDefaultKey(this.props.appId, this.props.value.className);
const defaultPointerKey = ColumnPreferences.getPointerDefaultKey(this.props.appId, this.props.value.className);
let dataValue = this.props.value.id;
if( defaultPointerKey !== 'objectId' ) {
dataValue = this.props.value.get(defaultPointerKey);
Expand Down Expand Up @@ -175,9 +175,9 @@ export default class BrowserCell extends Component {
this.setState({ ...this.state, content, classes })
}

async componentDidUpdate(prevProps) {
componentDidUpdate(prevProps) {
if ( this.props.value !== prevProps.value ) {
await this.renderCellContent();
this.renderCellContent();
}
if (this.props.current) {
const node = this.cellRef.current;
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Data/Browser/AddColumnDialog.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default class AddColumnDialog extends React.Component {
} catch (e) {
isDefaultValueValid = defaultValue === ''
}
return await this.setState({ defaultValue: formattedValue, isDefaultValueValid })
return this.setState({ defaultValue: formattedValue, isDefaultValueValid })
}

renderDefaultValueInput() {
Expand Down
12 changes: 6 additions & 6 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class Browser extends DashboardView {
const parent = await parentObjectQuery.get(entityId, { useMasterKey });
relation = parent.relation(relationName);
}
await this.setState({
this.setState({
data: null,
newObject: null,
lastMax: -1,
Expand Down Expand Up @@ -639,10 +639,10 @@ class Browser extends DashboardView {
editCloneRows: null,
};
if (relation) {
await this.setState(initialState);
await this.setRelation(relation, prevFilters);
this.setState(initialState);
this.setRelation(relation, prevFilters);
} else {
await this.setState({
this.setState({
...initialState,
relation: null,
});
Expand Down Expand Up @@ -676,7 +676,7 @@ class Browser extends DashboardView {
uniqueField = field;
}
});
await this.setState({ isUnique, uniqueField });
this.setState({ isUnique, uniqueField });

const data = await promise;
return data;
Expand Down Expand Up @@ -718,7 +718,7 @@ class Browser extends DashboardView {
async fetchRelation(relation, filters = new List()) {
const data = await this.fetchParseData(relation, filters);
const relationCount = await this.fetchRelationCount(relation);
await this.setState({
this.setState({
relation,
relationCount,
selection: {},
Expand Down
6 changes: 3 additions & 3 deletions src/dashboard/Data/Browser/ObjectPickerDialog.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class ObjectPickerDialog extends React.Component {
async updateFilters(filters) {
const { selection } = this.state;
const { className } = this.props;
await this.setState({
this.setState({
filters: filters,
selection: {}
});
Expand All @@ -199,7 +199,7 @@ export default class ObjectPickerDialog extends React.Component {
async updateOrdering(ordering) {
const { className } = this.props;
const { filters, selection } = this.state;
await this.setState({
this.setState({
ordering: ordering,
selection: {}
});
Expand All @@ -215,7 +215,7 @@ export default class ObjectPickerDialog extends React.Component {
async refresh() {
const { className } = this.props;
const { filters, selection } = this.state;
await this.setState({
this.setState({
data: null,
lastMax: -1,
selection: {}
Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/Data/Browser/PointerKeyDialog.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default class PointerKeyDialog extends React.Component {
};
}

async componentDidMount() {
const pointerKey = await ColumnPreferences.getPointerDefaultKey(this.props.app.applicationId, this.props.className);
componentDidMount() {
const pointerKey = ColumnPreferences.getPointerDefaultKey(this.props.app.applicationId, this.props.className);
this.setState({ name: pointerKey });
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib/ColumnPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ export function setPointerDefaultKey( appId, className, name ) {
localStorage.removeItem(className);
}

export async function getPointerDefaultKey( appId, className ) {
let pointerKey = await localStorage.getItem(pointerKeyPath(appId, className));
export function getPointerDefaultKey( appId, className ) {
let pointerKey = localStorage.getItem(pointerKeyPath(appId, className));
if ( !pointerKey ) {
// old pointer key.
pointerKey = await localStorage.getItem(className) || 'objectId';
pointerKey = localStorage.getItem(className) || 'objectId';
}
return pointerKey;
}
Expand Down