Reset Stores

Akita's provides resetStores() method that reset all the stores back to their initial state. It can be useful when you want to clean the store's data upon user logout.

In order to enable it globally, you should set the resettable option to true:

import { akitaConfig } from "@datorama/akita";
resettable: true

And in your service, you can call the global resetStores() method:

import { resetStores } from "@datorama/akita";
class AuthService {
logout() {
resetStores({ exclude: ['storeName'] }) // optionally exclude stores

In addition to that, you can set a specific store to be resettable:

@StoreConfig({ name: 'todos', resettable: true })
export class TodosStore extends EntityStore<TodosState> {
constructor() {

Now, you can call the store's reset() method.