Skip to content

Commit 12ee227

Browse files
authored
docs: update Reselect default memoization note (#4866) (#4886)
Updates the createSelector Behavior section to mention that Reselect 5.0.0 uses weakMapMemoize by default instead of lruMemoize, with improved memory management and automatic cleanup.
1 parent 28d433b commit 12ee227

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

docs/usage/deriving-data-selectors.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ Note that the second time we called `selectTodosForCurrentUser`, the "output sel
258258

259259
It's important to note that by default, **`createSelector` only memoizes the most recent set of parameters**. That means that if you call a selector repeatedly with different inputs, it will still return a result, but it will have to keep re-running the output selector to produce the result:
260260

261+
**Note:** As of Reselect 5.0.0, `createSelector` uses `weakMapMemoize` by default, which provides better memory management than the previous `lruMemoize` implementation. This means memoized values are automatically cleaned up when no longer referenced.
262+
261263
```js
262264
const a = someSelector(state, 1) // first call, not memoized
263265
const b = someSelector(state, 1) // same inputs, memoized

0 commit comments

Comments
 (0)