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.

Redux State Mutates unexpectedly

See original GitHub issue
  • Issue does not already exist /* As far as I can tell */
  • Identify exactly what aspect your issue is about
    • ignite base application

ignite doctor:

Computer
  Platform: darwin

Ignite
  Version: 1.5.0
  Path: /usr/local/bin/ignite

Node
  Version: v5.4.0
  Path: /Users/christopherbradley/.nvm/versions/node/v5.4.0/bin/node

NPM
  Version: 3.10.6
  Path: /usr/local/bin/npm

Yeoman
  Version: 1.8.4

React Native CLI
  Version: 1.0.0

App
  React Native Version: 0.31.0

Something seems to be destroying redux state. I’ve created a test example demonstrating the issue here: https://github.com/chrbradley/ingiteTestState/tree/add-new-state

In my example I modify the state in the StartUp saga and then MapStateToProps in the TestState component.

You can see that the state is present when the component initially renders, but something modifies the state which triggers a rerender of TestState component.

When the TestState component rerenders, the state is no longer there. Did I miss something when I created the new state object?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
lukaberscommented, Sep 17, 2016

Firiing the startup action like GantMan said is the solution at the moment and it works for me…

0reactions
GantMancommented, Sep 19, 2016

fixed by @lukabers in #379 - will be in next version’s release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can a mutable object in Redux store that is only mutated ...
The mutable object is sometimes mutated outside of Redux, for example, by calling methods on the object itself. My question is, is this...
Read more >
Common Error: Accidentally Mutating State in React
In React, the state is immutable. In simple terms it means that you should not modify it directly. Instead a new object should...
Read more >
What Would Happen If You Mutated Your React Redux State?
Mutating your state would result in inconsistent UI. But besides that, there are some other consequences. It would break time-travel debugging, ...
Read more >
Immutability in React and Redux: The Complete Guide
In React's case, it's important to never mutate state or props. Whether a component is a function or a class doesn't matter for...
Read more >
Unexpected initial state mutation · Issue #49 - GitHub
The getStateFromCookies(initialState, paths) call will mutate initialState . In server-side rendering setting this leads to really bad stuff ...
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