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

Allow wildcards in immutable check middleware ignored paths #2553

Closed
cfecherolle opened this issue Jul 28, 2022 · 2 comments · Fixed by #3129
Closed

Allow wildcards in immutable check middleware ignored paths #2553

cfecherolle opened this issue Jul 28, 2022 · 2 comments · Fixed by #3129

Comments

@cfecherolle
Copy link

cfecherolle commented Jul 28, 2022

Hi!

Rather than an issue, I'd like to submit a suggestion: it would be great if the configuration API for the immutable check middleware could accept and handle wildcards. Let me explain:

On some parts of our Redux store, we use a lib called redux-undo to wrap data, which handles past, present and future of data in our states to allow us to undo/redo stuff. Problem is, such a lib adds its own abstraction and intermediary nodes to handle these different "moments" of data state, ending in node paths such as :

entity._latestUnfiltered.edges.entities.edges.byFrontId...
entity.present.edges.entities.edges.byFrontId...
entity.future.0.edges.entities.edges.byFrontId...

for something that, simply put, is just:
entity.edges.entities.edges.byFrontId...

... but is wrapped in many different ways.

Obviously, that makes it hard to ignore, say the byFrontId object for immutability checks in our state because it can appear in lot of different paths. I tried adding a wildcard in the middle of my path, but it didn't work (which was quite obvious, but I had to try 😆)

Which brings us to my suggestion: would it be possible to implement wildcards in ignoredPaths?
If not, is there another way I could achieve what I want to do, apart from ignoring entity, which is too wide?

@markerikson
Copy link
Collaborator

It's certainly possible. As my mentor has said many times: "We can do anything - it's just software!" :)

What is probably needed is allowing passing a regex instead of just a string, and tweaking the logic to make use of that regex.

This is low priority for us atm, but if you want to file a PR we can definitely try to get that in.

@cfecherolle
Copy link
Author

Thanks for the feedback :)
Indeed I could try and find some time to submit a PR myself, though I would need to wrap my head around the repo code first!

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