question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App stops executing next lines of code after network requests

See original GitHub issue

What’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 reactotron

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:

doctor

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
carlosa54commented, Jan 14, 2022

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

2reactions
ibrahimelaradicommented, Jan 14, 2022

Hello @carlosa54, I commented out the wrapper and it worked fine, I’ll refactor toggle-storybook.tsx to use ES6 import Thank you!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found