Empty array is changing to empty object on rehydrate
See original GitHub issueconst initialState = [];
export default function(state = initialState, action) {
switch (action.type) {
case constants.UPDATE_QUESTIONS:
return action.questions;
}
return state;
}
To test I deleted the app and reinstalled and started the app. The questions state started as [] and did not change. I restarted the app and then:
Before rehydrate:
After rehydrate:
redux-persist: 3.5.0
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Redux Persist state is empty after rehydration - Stack Overflow
I'm facing a strange issue. The rehydration worked in my app until I switched to remote dev tools that ...
Read more >empty - Manual - PHP
When using empty() on inaccessible object properties, the __isset() ... I normally count() an array, so I wanted to see how empty() would...
Read more >Array.prototype.pop() - JavaScript - MDN Web Docs
The pop() method removes the last element from an array and returns that element. This method changes the length of the array.
Read more >Usage Guide - Redux Toolkit
Importing or creating the root reducer function; Setting up middleware ... Immutable update logic, like spreading objects or copying arrays, ...
Read more >Advanced Usage - styled-components
... Tagged Template Literals, Server-Side Rendering and Style Objects. ... or an empty string (""), which means you're free to use short-circuit evaluation ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
2020, this is still occurring when root is a solo array. I have a nested persist root it overwrites my initialState = [] with an object containing {_persist… rehydrated… }
I had to change my structure to:
initialState = { data: [ … ] }
now it works the way it’s supposed to