Move all state setting to inside of then block of computeComponentState in fetchApp (#4946)

This commit is contained in:
Sherfin Shamsudeen 2022-12-12 21:45:44 +05:30 committed by GitHub
parent 8b467026d9
commit c0883935c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -415,17 +415,16 @@ class EditorComponent extends React.Component {
},
},
async () => {
// TODO: Check if this runQueries is required
computeComponentState(this, this.state.appDefinition.pages[homePageId]?.components ?? {}).then(() => {
computeComponentState(this, this.state.appDefinition.pages[homePageId]?.components ?? {}).then(async () => {
this.runQueries(data.data_queries);
this.setWindowTitle(data.name);
this.setState({
showComments: !!queryString.parse(this.props.location.search).threadId,
});
for (const event of dataDefinition.pages[homePageId]?.events ?? []) {
await this.handleEvent(event.eventId, event);
}
});
this.setWindowTitle(data.name);
this.setState({
showComments: !!queryString.parse(this.props.location.search).threadId,
});
for (const event of dataDefinition.pages[homePageId]?.events ?? []) {
await this.handleEvent(event.eventId, event);
}
}
);