Skip to content

Add weakMap cache size dev check and revamp docs - #782

Merged
markerikson merged 8 commits into
masterfrom
feature/weakmap-devcheck
Aug 15, 2026
Merged

markerikson merged 8 commits into
masterfrom
feature/weakmap-devcheck

Conversation

@markerikson

@markerikson markerikson commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

This PR:

  • Adds a new cacheSizeCheck dev check for weakMapMemoize, which warns when >1000 cache entries are added
  • Ended up doing a bunch of docs restructuring since I was going to have to document the new check:
    • Revamped all of the API reference headers to use a consistent "API Reference / Usage Guide" H2 pattern
    • Updated Docusaurus to allow up to H4 headings
    • Added a usage guide to createSelector to describe memoization functions
    • Changed the existing "how to customize dev checks" content to be in the page once instead of per-check
  • Actually added the content for the new check
  • Renamed development-only-stability-checks to development-only-checks and fixed all references

Warns in development when a single primitive argument position has
cached more than 1000 distinct values. Results keyed by primitives are
held strongly and only released by clearCache(), so a steadily growing
primitive Map is the unbounded-growth pattern from #635 - typically a
selector called with ever-changing ids, offsets, or timestamps.

The check measures each primitive Map individually rather than a total
across the cache tree: Maps nested under an object key's WeakMap node
are freed when that object is collected, so a running total would
accumulate phantom counts and warn about healthy usage.

Configured globally via setGlobalDevModeChecks({ cacheSizeCheck }) with
the usual once/always/never frequencies. Compiles out of production
builds.
@netlify

netlify Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for reselect-docs ready!

Name Link
🔨 Latest commit bdd867e
🔍 Latest deploy log https://app.netlify.com/projects/reselect-docs/deploys/6a80de919d51330008d3eea7
😎 Deploy Preview https://deploy-preview-782--reselect-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@codesandbox-ci

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@markerikson
markerikson merged commit f4a5eba into master Aug 15, 2026
29 checks passed
@aryaemami59
aryaemami59 deleted the feature/weakmap-devcheck branch October 28, 2026 13:41
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.

1 participant