react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Async storage doesn't work when debugging in chrome using genymotion emulator

Open austinksmith opened this issue 10 years ago • 43 comments

Using a macbook pro running 10.11.4 El Capitan

Using AsyncStorage api with android geny motion emulator, when debugging in chrome AsyncStorage does not operate

   componentWillMount: function() {
       var token;
       AsyncStorage.getItem('token').then((data) => {
         if(data) {
           token = data;
           return token;
      } else {
        this.setState({
          noAuth: true
        });
      }
    }).then((token) => {
      setTimeout (() => {
        this.setState({
          token: token,
          loading: false,
          noAuth: true
        });
        this.props.navigator.push({
          id: 'HomeView',
          passProps: {'state': this.state},
          sceneConfig: Navigator.SceneConfigs.FadeAndroid
        });
      }, 300);
    }).

This seems to run, but my timeout/navigate to never hits the homepage if i'm in debug mode, obviously this presents a few problems because then i can't debug why things aren't working lol. Any guidance would be much appreciated. Thanks.

austinksmith avatar May 17 '16 21:05 austinksmith

@facebook-github-bot stack-overflow

DanielMSchmidt avatar May 18 '16 07:05 DanielMSchmidt

Hey @austinksmith and thanks for posting this! @DanielMSchmidt tells me this issue looks like a question that would be best asked on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. Will close this as this is really a question that should be asked on SO.

ghost avatar May 18 '16 07:05 ghost

I think you've misunderstood the question a bit, asyncstorage doesn't function when debugging in chrome and using the emulator. This to me is a major bug as it prevents me from debugging my application.

austinksmith avatar May 20 '16 15:05 austinksmith

Sorry for that 😞 @facebook-github-bot reopen

DanielMSchmidt avatar May 20 '16 19:05 DanielMSchmidt

It seems to be intermittent when it works, when running on an actual device everything appears to function fine. My use case is basically, I have a splash/login screen and when someone logs in I'm saving a token using asyncstorage, in my homeview I fetch that token from asyncstorage and render a list of events. The problem is when debugging about 70% of the time the homescreen will simply hang, my breakpoints never get hit and the application does not freeze I can still reload the js and enable the perf monitor but it appears my token is never getting fetched from storage which is required for me to authenticate with my api endpoint and render my events so i'm met with my homepage without any events.

I'm emulating a Nexus 5 running android 4.4.4 API 19 Running chrome Version 50.0.2661.102 (64-bit) Using a MBP Retina running El Capitan 10.11.4 With the following extensions https://www.dropbox.com/s/tdd7zwwnhswul7i/Screenshot%202016-05-20%2016.13.32.png?dl=0

austinksmith avatar May 20 '16 20:05 austinksmith

I have the same issue. @DanielMSchmidt It seems like the github-bot failed in reopening the issue.

limemloh avatar Aug 17 '16 13:08 limemloh

I have the same issue. When DEBUG JS Remotely is on, accessing AsyncStorage via redux-persist just hang. It works well on iOS.

jgkim avatar Aug 17 '16 19:08 jgkim

@facebook-github-bot reopen

DanielMSchmidt avatar Aug 17 '16 19:08 DanielMSchmidt

Okay, reopening this issue.

ghost avatar Aug 17 '16 19:08 ghost

i'm having the same problem running rn-0.31 on the android emulator (Android 6.01) and on a nexus 4 device. computer is a thinkpad x220 running ubuntu 16.04 chrome version 52.0.2743.82

UPDATE: it seems weird, but implementing the 'Delay Render Until Rehydration Complete' recipe from the redux-persist repo (https://github.com/rt2zz/redux-persist/blob/master/docs/recipes.md) solved the issue for me...

thorstenweber83 avatar Aug 21 '16 20:08 thorstenweber83

@thorstenweber83 I don't know why, but I also confirmed that the Delay Render Until Rehydration Complete solved the issue. @rt2zz Any thoughts?

jgkim avatar Aug 21 '16 21:08 jgkim

I'm getting the same issue in chrome too. Nexus 5 with remote debugging through chrome. React native version 31.0

After throwing in a few console logs, it seems the callback registered when calling RCTAsyncStorage.multiGet in Libraries/Storage/AsyncStorage.js never gets called. Everything works fine on the device though so it seems to be an issue with the debugger.

benhughes avatar Oct 19 '16 11:10 benhughes

Same issue. Sometimes the debugger works fine, sometimes AsyncStorage is (really) slow (3-9 seconds, and I've even seen it take 9 minutes for AsyncStorage.multiGet to return, and sometimes it appears to hang indefinitely (15+ minutes). Turning off Debug JS Remotely seems to solve the issue immediately. Interestingly, I haven't seen the issue occur during the first reload when you turn the debugger on.

I'm running: (actual device) Nexus 5x on 7.1.1 Chrome 54.0.2840.71 React Native 0.35.0

Edit: I was also already using the 'Delay Render Until Rehydration Complete' recipe, so that seems to have had no effect for me

BlooJeans avatar Oct 31 '16 18:10 BlooJeans

This could be the same issue that we are facing here #12830 (no solutions).

bartolkaruza avatar May 01 '17 14:05 bartolkaruza

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

hramos avatar Jul 20 '17 21:07 hramos

Same issue.

I think this problem should be payed attention.

Ble3k avatar Dec 14 '17 10:12 Ble3k

There seems to be a trend of closing out issues when they're only inactive due to users waiting for response from maintainers...not a great practice. Here we are almost 2 years later and this still hasn't been addressed.

austinksmith avatar Dec 14 '17 13:12 austinksmith

The two month inactivity period before closing can be bumped up now that we have a smaller number of open issues, but I'd still recommend submitting a pull request as a more appropriate long term fix. We lean heavily on the community providing fixes for issues they run into. Please tag this issue if a PR is submitted and we can re-open it.

hramos avatar Dec 21 '17 17:12 hramos

@hramos if you don't have anyone to look at the issue how about you write that on the issue and then perhaps someone can pick it up and submit the PR. I don't see what the practice of closing issues that you have not even attempted to reproduce really achieves apart from artificially reducing your list of outstanding issues. I've seen this happen a lot on the react-native project and it's pretty depressing to see a project being run like this.

GmeduoyeClaymore avatar Jan 04 '18 16:01 GmeduoyeClaymore

Maybe related to #14101

cihadturhan avatar Jan 15 '18 05:01 cihadturhan