Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redux don't update component in dev env #3859

Closed
Borrelli opened this issue Mar 27, 2019 · 16 comments
Closed

Redux don't update component in dev env #3859

Borrelli opened this issue Mar 27, 2019 · 16 comments

Comments

@Borrelli
Copy link

Borrelli commented Mar 27, 2019

馃悰 Bug Report

Environment

Expo CLI 2.13.0 environment info:
System:
OS: Windows 10
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD

//package.json
  "dependencies": {
    "expo": "^32.0.6",
    "react": "^16.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.1.tar.gz",
    "react-native-elevated-view": "0.0.6",
    "react-native-gesture-handler": "^1.1.0",
    "react-native-paper": "^2.12.0",
    "react-native-responsive-dimensions": "^2.0.1",
    "react-navigation": "^2.0.1",
    "react-navigation-material-bottom-tabs": "^0.4.0",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1"
  },

Steps to Reproduce

Doing a mapStateToProps with a console.log for checking if component is updating with new props when dispatch.

const mapStateToProps = (state) => {
console.log("props updating")
    return {
        card: state.cardHandler.card
    }
}
export default connect(mapStateToProps)(Item)

You can see this issue for more information and reproducing

https://stackoverflow.com/questions/55315191/connect-doesnt-refresh-when-state-change-on-react-native-with-redux/

Expected Behavior

Component with connect() should reload on store modification

Actual Behavior

Nothing happened on developpement mode, but if env is production, redux working and component update.

//settings.json
{
  "hostType": "lan",
  "lanType": "ip",
  "dev": true, //working with false
  "minify": false,
  "urlRandomness": "53-g5j"
}
@Borrelli Borrelli changed the title Redux don't upload component in dev env Redux don't update component in dev env Mar 27, 2019
@AdamJNavarro
Copy link
Contributor

AdamJNavarro commented Mar 27, 2019

Hey @Borrelli,

Before we investigate this, as I suspect it may not be Expo-related, can you try reproducing this issue in a vanilla React Native project and seeing if it still persists? If it works properly then please create a Snack with just the minimal code and dependencies required to reproduce the issue so we can debug on our end.

Cheers,
Adam

@Borrelli
Copy link
Author

Please, can you explain me what you mean by "reproducing this issue in a vanilla React Native project".
is it related to https://www.npmjs.com/package/react-native-vanilla ?

@AdamJNavarro
Copy link
Contributor

Yes, sorry for the confusion. The phrase vanilla react native most often means a plain react-native project. You'll want to follow the React Native CLI Quickstart guide here.

@Borrelli
Copy link
Author

Borrelli commented Mar 27, 2019

I put the projet on snack and there is it:
https://snack.expo.io/@borrelli/measy

You can check bug on clicking an item, and click on "AJOUTER AU PANIER", the store work, you can see a text add and delete.

But if i run it on android emulator or expo cli with device on developpement mode. This shield don't add and delete. The store don't update the component...

@Borrelli
Copy link
Author

I solved the problem by completely reinstalling the application. Probably a problem of incompatibility...

@adamsythe
Copy link

I have this issue accross all 3 computers that run my app. I have tried uninstalling and reinstalling

@HenriBrg
Copy link

HenriBrg commented May 2, 2019

Me too, still stuck with component which is not rendered in development environment, but it works in production mode of Expo

@josharrowsmith
Copy link

great spot, ive been stuck on this for 4 hours. please fix

@Borrelli
Copy link
Author

Me too, still stuck with component which is not rendered in development environment, but it works in production mode of Expo

Do you try a clean reinstallation?

@adamsythe
Copy link

Me too, still stuck with component which is not rendered in development environment, but it works in production mode of Expo

Do you try a clean reinstallation?

I have this problem with all 3 computers i use for development, each one when i started development i installed expo and pulled the project from scratch

@msevestre
Copy link

Do you have some special code initialization that is only happening when DEV is true or something like this? This could explain why your code only works in production

@adamsythe
Copy link

Not as far as I can tell

@Borrelli
Copy link
Author

@msevestre @adamsythe the DEV env is handling by expo. It should be write on the official doc ...

@msevestre
Copy link

@Borrelli @adamsythe
__DEV__ is true in development. THis allows you to add specific middleware such as redux-logger or REDUX_DEV_TOOLS etc.

The bug description strongly suggests that something is happening to the redux middleware in dev mode that is breaking redux. This actually has nothing to do with expo

@adamsythe
Copy link

here are my dev dependencies
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"eslint": "^5.8.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-rallycoding": "^3.2.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.11.1",
"eslint-plugin-react-native": "^3.5.0",
"eslint-plugin-standard": "^4.0.0",
"husky": "^1.1.3",
"lint-staged": "^8.0.4",
"schedule": "^0.4.0"
}

@bellini666
Copy link

I think I'm suffering from this issue in SDK 33 but the other way around.

Upgrading to react-redux 7 was not possible since it broke a few things. Keeping react-redux 6 (the same that I was using in SDK 32) is working, but redux only updates my components in development mode. In production mode it will not update.

@lock lock bot added the outdated label Dec 10, 2019
@lock lock bot locked and limited conversation to collaborators Dec 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants