firebase.auth () зависает при включенной отладке Chrome - PullRequest
0 голосов
/ 14 марта 2019

Используя те же учетные данные, действие входа в систему зависает в firebase.auth (), когда включена отладка chrome. Он зависает, пока я не нажму на экран. Только тогда авторизация продолжается.

Как только я отключаю отладку Chrome, действие по входу вкл. firebase.auth () работает так быстро, как и ожидалось.

вот мой package.json для пострадавшего действия:

Действие:

export const loginUser = ({ email, password }) => (dispatch) => {
  dispatch({ type: LOGIN_USER });
  return firebase
    .auth()
    .signInWithEmailAndPassword(email, password)
    .then((user) => {
      setTimeout(() => null, 0);
      dispatch(() => saveCredentials(email, password))
        .then(dispatch(loginUserSuccess(user)))
        .then(dispatch(weekplanFetch()))
        .then(dispatch(recipeLibraryFetch()))
        .then(() => {
          NavigationService.navigate('Home');
        });
    })
    .catch((error) => {
      console.log(`sign in fail ${error}`);
      return firebase
        .auth()
        .createUserWithEmailAndPassword(email, password)
        .then((user) => {
          dispatch(() => saveCredentials(email, password))
            .then(dispatch(loginUserSuccess(user)))
            .then(dispatch(initWeekplan()))
            .then(dispatch(initRecipeLibrary()))
            .then(() => {
              NavigationService.navigate('Home');
            });
        })
        .catch((userCreateFail) => {
          // console.log(`user create fail ${userCreateFail}`);
          dispatch(loginUserFail(userCreateFail.message));
        });
    });
};

package.json

{
  "name": "WhatsForDinner",
  "version": "1.0.5",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "ios:beta": "(cd ios/ && bundle exec fastlane beta)",
    "ios:commit": "cd ios/ && bundle exec fastlane commit",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "prettier": "prettier --write '*.js'",
    "format-code": "yarn run prettier && yarn run lint:fix",
    "precommit": "lint-staged",
    "test:coverage": "jest --coverage && open coverage/lcov-report/index.html"
  },
  "lint-staged": {
    "*.js": [
      "yarn run format-code",
      "git add",
      "jest --bail --findRelatedTests --coverage"
    ]
  },
  "dependencies": {
    "firebase": "^5.8.6",
    "prop-types": "^15.6.0",
    "react": "16.6.3",
    "react-native": "0.57.8",
    "react-native-code-push": "^5.5.2",
    "react-native-image-picker": "^0.28.0",
    "react-native-keychain": "^3.0.0",
    "react-native-paper": "^1.12.0",
    "react-native-vector-icons": "^6.4.1",
    "react-navigation": "^1.6.1",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "yarn": "^1.9.4"
  },
  "devDependencies": {
    "babel-eslint": "^8.2.2",
    "babel-jest": "^23.4.2",
    "babel-preset-react-native": "^5",
    "enzyme": "^3.7.0",
    "enzyme-adapter-react-16": "^1.6.0",
    "eslint": "^4.18.1",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.12.3",
    "husky": "^0.14.3",
    "jest": "22.4.2",
    "jest-fetch-mock": "^2.1.0",
    "lint-staged": "^7.2.2",
    "prettier": "1.10.2",
    "react-dom": "^16.7.0",
    "react-test-renderer": "16.4.1",
    "redux-mock-store": "^1.5.3"
  },
  "jest": {
    "preset": "react-native",
    "setupFiles": [
      "<rootDir>/tests/setup.js"
    ],
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    },
    "collectCoverageFrom": [
      "app/**/*.js",
      "!app/components/index.js"
    ],
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-navigation)"
    ]
  }
}
...