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

[core] Add excluded paths option #109

Open
3 tasks done
bisubus opened this issue Aug 20, 2022 · 3 comments
Open
3 tasks done

[core] Add excluded paths option #109

bisubus opened this issue Aug 20, 2022 · 3 comments
Labels
✨ enhancement New feature or request

Comments

@bisubus
Copy link

bisubus commented Aug 20, 2022

Clear and concise description of the problem

The suggestion is to add an option to exclude paths. This allows for more fine-grained persistence without requiring to change store structure:

persist: [{
  key: 'foo-unsecure',
  paths: ['foo'],
  excludedPaths: ['foo.bar', 'foo.baz'],
  storage: localStorage
}, {
  key: 'foo',
  paths: ['foo.bar', 'foo.baz'],
  storage: sessionStorage
}]

Suggested solution

            let toStore = state;

            if (paths?.length) {
              toStore = pick(toStore, ...paths);
            }

            if (excludedPaths?.length) {
              toStore = omit(toStore, ...excludedPaths);
            }

Alternative

No response

Additional context

No response

Validations

@bisubus bisubus added the ✨ enhancement New feature or request label Aug 20, 2022
@prazdevs
Copy link
Owner

prazdevs commented Sep 1, 2022

Hi, this is a fairly easy enhancement that can be considered! I'll try to do it asap :)

@prazdevs prazdevs changed the title Add excluded paths option [core] Add excluded paths option Sep 7, 2022
@marktlinn
Copy link

Happy to do this, if the issue is still open for assignment?

@prazdevs
Copy link
Owner

Hi @marktlinn it still is, the requirements are to use no external libraries, and keep the code as small and readable as possible 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants