Skip to content

feat(asyncStorage): support RegEx and add pattern string match to ignore async plugin key #1559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JDMathew
Copy link

@JDMathew JDMathew commented May 29, 2025

Please verify the following:

  • yarn build-and-test:local passes
  • I have added tests for any new features, if relevant
  • README.md (or relevant documentation) has been updated with your changes

Describe your PR

This PR improves the asyncStorage() ignore functionality by adding support for regular expression patterns alongside existing string patterns. It also allows existing string patterns to get a partial match ignoring any keys that partially match.

Changes:

  • Added shouldIgnore() function to handle both string and RegExp patterns
    • String patterns continue to work as before (with substring matching)
    • RegExp patterns enable more sophisticated key filtering (e.g., ^debug_, _cache$)
  • Documentation Updated
    • Updated usage documentation with clear explanation of pattern matching behavior
    • Added examples showing both string and RegExp usage
    • Clarified that strings do substring matching while RegExp uses standard regex matching

Benefits:

  • More flexible filtering options for developers
  • Better control over which AsyncStorage keys are sent to Reactotron
  • Maintains full backward compatibility

Anecdote:
My personal use case was that aws amplify was storing tokens in AsyncStorage under key names I don't have control of this would be something like @MemoryStorage:CognitoIdentityServiceProvider.4589348z&... where I can now pattern match against @MemoryStorage:CognitoIdentityServiceProvider.

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