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.

Localize component doesn't work with redux-immutable

See original GitHub issue

Hi there, thanks for a great project, we are using this in our app.

The higher order component Localize does not work when using redux-immutable, this is because the mapStateToProps function expects to find the slice at state[slice], whereas when using the redux-immutable combineReducers it saves the state as a Map.

This can be worked around, for example in our app we have used the normal combineReducers so that our state itself is a normal object, but our slices are immutable Maps. However this is not ideal because it breaks some conventions across our code base. Also it could put people off when trying to implement what is otherwise a great translation solution.

I suggest that a check is made and if the state object is a Map then state.get(slice) is called, I have tested this in my app and it works fine.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jamiedustcommented, Jan 29, 2018

I have submitted a pull request #50 which solves the issue described above.

0reactions
ryandrewjohnsoncommented, Mar 3, 2018

Fixed in #58 and released in v2.16.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - react-localize-redux
react -intl doesn't work with Redux out of the box, and needs an additional library react-intl-redux to add support. For further discussion on...
Read more >
Immutable JS broken on V3 · Issue #82 · ryandrewjohnson/react ...
Looks like LocalizeProvider immutable stores are not supported, if store is a Map then localize should be retrieved using get('localize'): const ...
Read more >
Redux FAQ: Immutable Data
React -Redux's connect method generates components that shallowly check reference changes to the root state, and the return values from the ...
Read more >
Localization with React Hooks and Redux Toolkit - Medium
I recently tried to implement my Simple dynamic localization in VueX ... How could our class signal the parent React component that the ......
Read more >
Redux not updating components when deep Immutable state ...
So far, this all seems to work fine! In Redux DevTools, it shows up as an action as expected. However, none of my...
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