docs and tests: filter out specific actions from being sent to Redux DevTools#3252
docs and tests: filter out specific actions from being sent to Redux DevTools#3252dai-shi merged 14 commits intopmndrs:mainfrom
Conversation
feat: filter out specific actions from being sent to Redux DevTools
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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. |
|
Thanks for the suggestion.
Could you put the link to the feature in Redux DevTools? |
dai-shi
left a comment
There was a problem hiding this comment.
The code looks reasonable in general.
here it is: |
|
Let's use the same terminology |
dai-shi
left a comment
There was a problem hiding this comment.
Oh, do we just need to passthrough it? That's sweet.
Remaining:
- fix CI error (format?)
- update README
|
Thanks. Please run prettier, which should be easier.
Oops, I meant the PR description. But, fixing the docs is great! |
|
Hm, merging main causes the CI failure? Could you check it? Let me know if you need any help. |
Sure, I will! |
|
tests passed locally. linter / formatter issue from time to time. |
dai-shi
left a comment
There was a problem hiding this comment.
LGTM
Thanks for your contribution!
|
We need to figure out how CIs are failing. |
|
Add actionsDenylist Documentation and Tests
Summary
This PR adds comprehensive documentation and test coverage for the
actionsDenylistoption in the Zustand DevTools middleware. This option allows developers to filter out specific actions from Redux DevTools using regex patterns, and is passed directly to Redux DevTools Extension.Documentation Added
Updated
docs/middlewares/devtools.mdAdded a comprehensive new section titled "Filtering actions with actionsDenylist" that provides:
API Reference Section
actionsDenylistas an optional parameter acceptingstring | string[]name,store, etc.Usage Examples
Provided three distinct examples demonstrating different filtering scenarios:
Array Pattern Filtering: Shows how to filter multiple action categories using an array of regex patterns
internal/.*andsecret/.*actions simultaneouslySingle Pattern Filtering: Illustrates using a single regex string for simpler cases
'secret.*'to hide all secret-related actionsReal-World Authentication Store: Complete, practical example showing:
Educational Content
Use Cases: Explained four primary scenarios for using
actionsDenylist:Technical Notes: Added important clarifications:
Table of Contents Update
Usage Example from Documentation
Tests Added
Updated
tests/devtools.test.tsxAdded a dedicated test suite for the
actionsDenylistfeature to ensure proper functionality and prevent regressions.Test Suite Structure
Created a new
describeblock named'actionsDenylist'containing comprehensive test coverage:Test Case: "should pass actionsDenylist option to Redux DevTools"
Purpose: Verifies that the
actionsDenylistoption is correctly passed through to Redux DevTools ExtensionWhat it tests:
actionsDenylistto Redux DevTools['secret.*']) is correctly handledextensionConnector.connect()receives the option in its configuration objectTest Implementation Details:
actionsDenylist: ['secret.*']expect.objectContaining()to verify the option exists in the connection configWhy this test is important:
Test Coverage Stats
actionsDenylisttest)Integration with Existing Tests
The new test integrates seamlessly with the existing DevTools test infrastructure:
createStorehelper functiongetNamedConnectionApisutilityname,store,enabled)Future-Proofing
This test ensures:
actionsDenylistoptionTest Implementation
Benefits
Files Modified
docs/middlewares/devtools.md- Added comprehensive documentation sectiontests/devtools.test.tsx- Added test coverage for the optionTesting