-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(persist-state): 🔥 excludeKeys operator #135
Conversation
@@ -80,3 +80,19 @@ export const persist = persistState(authStore, { | |||
storage: localForage, | |||
}); | |||
``` | |||
|
|||
## Excluding keys from saved state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Excluding keys from saved state | |
## Excluding keys from the state |
|
||
## Excluding keys from saved state | ||
|
||
`excludeKeys()` operator can be used to exclude some keys from saved state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`excludeKeys()` operator can be used to exclude some keys from saved state: | |
The `excludeKeys()` operator can be used to exclude keys from the state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't fixed those yet. Was the merge intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, please fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I leave the operator name as is or do you want to rename it to omitKeys
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leave it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NetanelBasal thank you very much for all the awesome open source libraries you have created and articles you have written 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
key: 'todos', | ||
storage: localStorageStrategy, | ||
source: () => todoStore.pipe( | ||
excludeKeys(['ids', 'entities']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that omitKeys
is more suitable. See lodash naming for example https://lodash.com/docs/4.17.15#omit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a matter of personal preference. omit
might be better because it's shorter and sounds a bit more formal, but exclude
is more widely used word and when you have auto-completion in your IDE the length doesn't really matter.
Anyway, you can choose whichever you prefer.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #129
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Discussion