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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HMR][Redux] Updating reducer code disconnect the app from the store #16148

Closed
Fr33maan opened this issue Sep 30, 2017 · 2 comments
Closed

[HMR][Redux] Updating reducer code disconnect the app from the store #16148

Fr33maan opened this issue Sep 30, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Fr33maan
Copy link

Is this a bug report?

Yes it might be, it's now 10 hours I'm trying everything to get rid of it but I still don't understand what is going on.

Have you read the Contributing Guidelines?

Yes

Environment

OS: Linux 3.16
Node: 8.2.1
Yarn: 0.27.5
npm: 5.3.0
Watchman: 4.7.0

Packages: (wanted => installed)
react-native: 0.48.4 => 0.48.4
react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Target Platform: Android (6)

Steps to Reproduce

(Write your steps here:)

  1. Click on the button, action gets dispatched and component is updated
  2. Edit and save App/Redux/SearchRedux
  3. Click on the button, actions gets dispatched and component is NOT updated

Expected Behavior

After editing a reducer, I would expect my component to still gets store updates and rerender if the connected state changes.

Actual Behavior

The component is not updated once I've edited and saved a reducer. I must restart the server to reconnect the Component to the store.

Reproducible Demo

git clone https://github.com/l1br3/ReactNative-Redux-HMR-Broken
npm run freshInstall

If use of iOs, look at the script in package.json.

I suspect react-navigation to be responsible of that because HMR does not support functionnal components but as HMR globally works, maybe it's just a ReactNative bug.
#13240

I tried many things bug I cannot get it work. I've also posted a question on SO in case it's just a misconfiguration but the more I dig into it, the less I understand what happens.

@Fr33maan
Copy link
Author

Fr33maan commented Sep 30, 2017

I tried to upgrade to API 26 which give me now the ability of just reloading the app instead of restarting the server but I loose my state anyway.

PS: API 26 with remote debuging caused crash for me on AVD

@Fr33maan
Copy link
Author

Solved, it was a misconfiguration.
It's very complicated to understand how it works, if replaceReducer is in the wrong file, then HMR does very strange things and mess with the state.
The solution was super easy, I just had to place it at the good place.

If someone experiences issues with Hot Module Replacement, React Native, Redux you can find a complete exemple, fully working on the repo linked in the issue.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 30, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants