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

[Docs Rewrite] Remove "Using Immutable.js" page #4053

Merged
merged 16 commits into from
Apr 1, 2021

Conversation

AaronPowell96
Copy link
Contributor

@AaronPowell96 AaronPowell96 commented Apr 1, 2021


Name: 📖 New/Updated Documentation Content
About: Adding a new docs page, or updating content in an existing docs page

PR Type

Does this PR add a new page, or update an existing page?

Checklist

What docs page is being added or updated?

  • Deleted: docs/recipes/UsingImmutableJS.md
  • Updated: docs/FAQ.md
  • Updated: docs/api/createStore.md
  • Updated: docs/faq/ImmutableData.md
  • Updated: docs/faq/ReactRedux.md
  • Updated: docs/introduction/Ecosystem.md
  • Updated: docs/recipes/README.md
  • Updated: docs/recipes/Troubleshooting.md
  • Updated: docs/recipes/structuring-reducers/BeyondCombineReducers.md
  • Updated: docs/recipes/structuring-reducers/StructuringReducers.md
  • Updated: docs/understanding/history-and-design/PriorArt.md
  • Updated: website/_redirects
  • Updated: website/sidebars.js

For Updating Existing Content

Do these updates change any of the assumptions or target audience? If so, how do they change?

Updated the recommendation of Immutable.js to be Immer, I have assumed these libraries are hot-swappable and replacements for each other. It is critical to confirm this as otherwise, wording may need to be changed.


Please see below key comments on changes I have made that should be questioned.

docs/FAQ.md -

Deleted references to using Immutable.JS with Redux.
Changed "Do I have to use Immutable.JS" to "Do I have to use Immer" - Is this correct still?

docs/faq/ImmutableData.md -

  • JavaScript Immutability presentation PDF - Does mention Immutable.js, however,
    it also provides solid understandings of immutability so I think it is worth keeping it?

  • Under "What approaches are there for handling data immutability? Do I have to use Immer?",
    I have kept the original Immutable.JS description, are these libraries swappable and the description is still correct?

docs/recipes/structuring-reducers/BeyondCombineReducers.md -

  • Here, I have removed a direct reference to Immutable.JS but kept the "combineReducers" description about immutable maps in general.
  • I swapped the description of using Slice reducers to recommend RTK that uses a createReducer utility, is this acceptable?

website/_redirects -

  • I have added redirects as I have seen fit, however, I couldn't seem to test them locally? (Tested in Netlify deploy preview and seems to work).
  • I have separated them out from other redirects for now as they are very specific, please advise on their location.

@netlify
Copy link

netlify bot commented Apr 1, 2021

Deploy preview for redux-docs ready!

Built with commit 03c835d

https://deploy-preview-4053--redux-docs.netlify.app

@markerikson
Copy link
Contributor

Thanks for filing this!

First observation: no, Immer and Immutable.js are not swappable for each other directly. They both operate in the same space (providing ways to immutably update values, and preventing accidental mutations), but they take very different approaches:

  • Immutable.js is a collection of data types like Map and List, implemented using a specialized internal data structure. Operations like Map.set() return new instances immutably, instead of mutating the existing instance. These data types are not compatible with plain JS data directly. Instead, you have to convert to/from plain JS data.
  • Immer is a single produce function that uses Proxies to wrap your original state in a "draft" value. You can "mutate" that draft, and Immer tracks all the attempted changes. It then replays those mutations immutably to return the desired result, same as if you'd done a bunch of nested object spreads and array slices by hand. Immer works specifically with plain JS data.

So, same problem space, very different approaches. If you're using Immutable.js already, it takes a bunch of work to migrate over to using Immer instead.

docs/api/createStore.md Outdated Show resolved Hide resolved
docs/faq/ImmutableData.md Show resolved Hide resolved
docs/faq/ImmutableData.md Outdated Show resolved Hide resolved
docs/introduction/Ecosystem.md Show resolved Hide resolved
docs/introduction/Ecosystem.md Outdated Show resolved Hide resolved
docs/recipes/structuring-reducers/BeyondCombineReducers.md Outdated Show resolved Hide resolved
docs/recipes/structuring-reducers/StructuringReducers.md Outdated Show resolved Hide resolved
docs/understanding/history-and-design/PriorArt.md Outdated Show resolved Hide resolved
docs/understanding/history-and-design/PriorArt.md Outdated Show resolved Hide resolved
docs/understanding/history-and-design/PriorArt.md Outdated Show resolved Hide resolved
@AaronPowell96
Copy link
Contributor Author

Thanks for the explanation!
I have made all the changes requested except this comment here: #4053 (comment)
I closed the comments as "resolved" but then realised that might be something you need to do? Hopefully, all is okay!

@markerikson
Copy link
Contributor

Y'know, let's just delete everything under the "Immutable Data" header in the "Ecosystem" page except for Immer. None of those other libs are relevant any more now that Immer exists.

(and yeah, marking comments as "resolved" is fine if you've made the relevant changes)

@markerikson
Copy link
Contributor

Heh, I love pasting in old URLs into previews and watching the redirects kick in :)

Awright, this is probably good enough for now. Thanks, really appreciate you doing this!

@markerikson markerikson merged commit 1b446bc into reduxjs:master Apr 1, 2021
webMasterMrBin pushed a commit to webMasterMrBin/redux that referenced this pull request Aug 21, 2021
webMasterMrBin pushed a commit to webMasterMrBin/redux that referenced this pull request Aug 21, 2021
webMasterMrBin pushed a commit to webMasterMrBin/redux that referenced this pull request Aug 21, 2021
webMasterMrBin pushed a commit to webMasterMrBin/redux that referenced this pull request Aug 21, 2021
webMasterMrBin pushed a commit to webMasterMrBin/redux that referenced this pull request Aug 21, 2021
webMasterMrBin pushed a commit to webMasterMrBin/redux that referenced this pull request Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants