Skip to content

Conversation

@synwix
Copy link

@synwix synwix commented Nov 17, 2025

fixes #4820

This PR updates the code example in Part 6 of the Redux Essentials tutorial ("Memoizing Selector Functions") to be technically accurate and better aligned with the section's teaching goals.

The previous example had two issues which are addressed here:

  • Technical Correction (reactionAdded): The example previously claimed the selector did not run after reactionAdded(). Because this action changes a post (and thus the parent posts array reference via Immer), the selector's input does change. This PR corrects the assertion to state that the output selector runs.

  • Pedagogical Enhancement (fetchNotifications): The core of this tutorial section is about preventing re-renders from unrelated state changes (like fetching notifications). The new block includes dispatch(fetchNotifications()) to provide the clear example that the memoized selector does not run when only an unrelated slice changes.

The revised example now covers all four key memoization scenarios clearly.

(Technical Note: Stating that the output selector runs is the most accurate description of the internal memoization logic in this context, even if the eventual component re-render might be prevented by a more complex equal function (which isn't the primary focus here). This was my thought process, although at first I explicitly stated this in the example, it cluttered the example and I came to the conclusion that it could potentially cause more confusion rather than helping the reader.)

@netlify
Copy link

netlify bot commented Nov 17, 2025

Deploy Preview for redux-docs ready!

Name Link
🔨 Latest commit 081b991
🔍 Latest deploy log https://app.netlify.com/projects/redux-docs/deploys/691b2174de402900080de897
😎 Deploy Preview https://deploy-preview-4821--redux-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

[Docs Fix] Selector example in Part 6 uses potentially misleading action and assertion for memoization

1 participant