App stops executing next lines of code after network requests
See original GitHub issueWhat’s going on?
I’m waiting for network requests to finish before change the state of the app using mobx actions, I’m using generator functions as described in here
Here’s a screenshot of logs from Reactotron, there should be a log after the API response that shows the state change
Action:
.actions((self) => ({
// ...
signIn: flow(function* (form: CustomerSigninForm) {
const api = self.environment.apis.guest
const signinResult = yield api.signinAsCustomer(form) // <= code stops executing here
// state change (saving token, fetching user details, etc
}),
// ...
}))
API method:
export class GuestApi extends Api {
// client config, other methods
async signinAsCustomer(form: CustomerSigninForm): Promise<SigninCustomerResult> {
const url = this.base + "/integration/customer/token"
const params = mapToCustomerSigninRequest(form)
const response = await this.apisauce.post<string>(url, params) // <-- Code lines after this line don't execute
if (!response.ok) {
return getGeneralApiProblem(response) || { kind: "bad-data" }
}
return { kind: "ok", token: response.data }
}
}
I’m experiencing this issue with both Android and iOS, however on Android, if I turn off DEV from cmd + M > Settings
and reload the app it works perfectly fine
I tried running it with minification enabled and the issue still persists, am I doing something wrong?
Steps to reproduce
Will create a reproduction repo if no one has faced this issue before
npx ignite-cli doctor
results:
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Wait for a task to end before executing the next code lines
I have a problem with my iOS app. The problem is causing a part of my code to download a "channel list" (JSON),...
Read more >Handling common JavaScript problems - MDN Web Docs
After the packages have finished installing, try loading up a JavaScript file: you'll see any issues highlighted with green (for warnings) and ...
Read more >Debug your app - Android Developers
The most common type is a line breakpoint that pauses the execution of your app at a specified line of code. While paused,...
Read more >Troubleshooting requests
This guide specifically discusses troubleshooting API requests. To troubleshoot issues with the Postman app, see Troubleshooting app issues.
Read more >Getting Started With Async Features in Python
A synchronous program is executed one step at a time. Even with conditional branching, loops and function calls, you can still think about...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @ibrahimelaradi out of curiosity can you remove/comment out the
<ToggleStorybook>
component in app.tsx and see if it works?https://github.com/infinitered/ignite/blob/10efc3878567926e9466c028c648ddb9e65f6b8d/boilerplate/app/app.tsx#L58-L69
Just in case I had a similar issue and I ended up fixing it by refactoring the file below to use ES6 import instead
https://github.com/infinitered/ignite/blob/10efc3878567926e9466c028c648ddb9e65f6b8d/boilerplate/storybook/toggle-storybook.tsx#L48
Hello @carlosa54, I commented out the wrapper and it worked fine, I’ll refactor
toggle-storybook.tsx
to use ES6 import Thank you!