Skip to content

Documentation unclear that weakMapMemoize is now the default memoizer #753

Closed

Description

@audi2014

as a developer i found mention about true behavior of memoization here https://reselect.js.org/introduction/v5-summary#breaking-changes
But i found this page only after playing with reselect in sandboxes. I was confused why this example may no effect: https://reselect.js.org/api/weakmapmemoize/#examples

llm generated:

Problem

The documentation doesn't clearly state that weakMapMemoize is now the default memoization function for createSelector (changed in commit 1ffd434).

This causes confusion because:

  1. Examples show redundant configuration: The weakMapMemoize example and API documentation show:
const selectItemsByCategory = createSelector(
  [
    (state: RootState) => state.items,
    (state: RootState, category: string) => category
  ],
  (items, category) => items.filter(item => item.category === category),
  {
    memoize: weakMapMemoize,      // ← This is already the default
    argsMemoize: weakMapMemoize   // ← This is also already the default
  }
)
  1. Developers may not realize the default changed: Those familiar with Reselect v4.x (where lruMemoize/defaultMemoize was default) may not realize the behavior has changed.

  2. Migration implications unclear: The difference between lruMemoize (cache size: 1) and weakMapMemoize (unlimited cache) has significant performance and memory implications that aren't highlighted.

Suggested Improvements

  1. Add a callout to the main documentation stating:

    ⚠️ Note: As of v5.0, weakMapMemoize is the default memoizer. Previous versions used lruMemoize with a cache size of 1.

  2. Update examples to either:

    • Remove the explicit memoize/argsMemoize options (since they're redundant)
    • Add comments explaining that this is showing explicit configuration but isn't necessary:
    {
      // These are the defaults in v5.0+, shown here for clarity:
      memoize: weakMapMemoize,
      argsMemoize: weakMapMemoize
    }

Current Versions Affected

  • v5.x documentation

Activity

  1. EskiMojo14 commented on Feb 10, 2026

    @EskiMojo14
    Contributor

    sure, PRs are welcome

  2. added
    Documentation
    on Mar 18, 2026
  3. changed the title [-]Documentation unclear that weakMapMemoize is now the default memoizer[/-] [+]Documentation unclear that `weakMapMemoize` is now the default memoizer[/+] on Mar 18, 2026
  4. markerikson commented on Aug 16, 2026

    @markerikson
    Contributor

    Fixed in #782 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions