[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
When I want to persist a part of the state I only can include/exclude based on complete stores.
It would be nice to select a nested slice of a store, e.g. 'auth.tokens'.
I want to persist only some parts of a store, e.g. the tokens in the auth store and reset dynamic properties like loading in an EntityStore.
(like it's possible in the ngxs plugin)
Thanks. I will add this feature to our roadmap.
This might be something interesting to look at as a backdrop to that:
https://github.com/cyrilletuzi/angular-async-local-storage
@twittwer I have added this functionality. In the next release, you can add to the include array what you asked. For example:
persistState({ include: ['todos.ui']});
persistState({ include: ['auth.token']});
@NetanelBasal Really nice, that was amazingly fast 馃槻
:tada: This issue has been resolved in version 1.7.0 :tada:
The release is available on npm package (@latest dist-tag)
Your semantic-release bot :package::rocket:
What happens when I want to do something like this:
I have an EntityStore of contacts with a UI state that sets the searchTerm. I want the contacts to be cached but I don't want the UI state of searchTerm to ever be cached. How do I do that?
export interface ContactState extends EntityState<Contact> {
ui:
{
contactFilterTerm: string;
}
}
const initialState = {
ui:{
contactFilterTerm: ''
}
} as ContactState;
@Injectable({ providedIn: 'root' })
@StoreConfig({ name: 'contact', cache: { ttl: 36000 }, resettable: true })
export class ContactStore extends EntityStore<ContactState, Contact> {
constructor() {
super(initialState);
}
}
Use the hooks to add/remove what you need - https://netbasal.gitbook.io/akita/enhancers/persist-state#custom-hooks.
Most helpful comment
@twittwer I have added this functionality. In the next release, you can add to the include array what you asked. For example: