Skip to content
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

store-devtools: actionsBlocklist issue with regex-like strings #2228

Closed
evgenyfedorenko opened this issue Nov 7, 2019 · 3 comments · Fixed by #2259
Closed

store-devtools: actionsBlocklist issue with regex-like strings #2228

evgenyfedorenko opened this issue Nov 7, 2019 · 3 comments · Fixed by #2259

Comments

@evgenyfedorenko
Copy link
Contributor

Minimal reproduction of the bug/regression with instructions:

    StoreDevtoolsModule.instrument({
      actionsBlocklist: ['[Counter] INCREMENT']
    })

StackBlitz example to create a reproduction:
https://stackblitz.com/edit/ngrx-seed-qtqp9m

Expected behavior:

I expect that counter increment action should not be visible and tracked in the store devtools Chrome extension. But it is not filtered.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

angular 8.2
ngrx 8.2
node 10.15.3
Chrome 78
macOS 10.14.6

Other information:

After the quick code check it looks like action type strings are not escaped for use in regex 'match' method therefore square brackets are treated there as 'character class' symbols.

I would be willing to submit a PR to fix this issue

[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No

@timdeschryver
Copy link
Member

This is because we're creating using the strings as a RegExp - https://github.com/ngrx/platform/blob/master/modules/store-devtools/src/utils.ts#L168-L171

As a workaround you can do:

actionsBlocklist: [/\[Counter\] Increment/.source] 

@evgenyfedorenko
Copy link
Contributor Author

This is because we're creating using the strings as a RegExp - https://github.com/ngrx/platform/blob/master/modules/store-devtools/src/utils.ts#L168-L171

As a workaround you can do:

actionsBlocklist: [/\[Counter\] Increment/.source] 

Right, but don't we want to fix it? Escape the string before passing it into match method? I was confused by it not working, I can imagine others may be too.

@timdeschryver
Copy link
Member

A fix would be great!
Was just pointing out how one could use it for now.

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

Successfully merging a pull request may close this issue.

2 participants