Akita: Akita v3 roadmap

Created on 21 Feb 2019  路  12Comments  路  Source: datorama/akita

Here are the changes that we plan to present in Akita v3. We're still open to any suggestions or feedback, so feel free to bring up anything you'd like.

BREAKING CHANGES:

  • EntityStore.set() - remove options param, i.e entityClass. done.
  • Remove EntityStore.createOrReplace() in favor of EntityStore.upsert(). done
  • Remove EntityStore.updateRoot() in favor of EntityStore.update(). done
  • Remove EntityStore.updateAll() in favor of EntityStore.update(null, newState), done
  • Store.setState is internal and changed to _setState() - use only the update() method. done
  • Remove mapWorker. done
  • Remove array helpers. done
  • Remove decrement and increment. done
  • Remove Query.selectOnce - use select().pipe(take(1)). done
  • Remove deprecated Query.getSnapshot(). done
  • Remove noop - use the of() observable. done
  • Remove isPristine and isDirty in favor of new caching functionality. done
  • The action decorator takes the action name instead of an object. done
  • Remove EntityStore.isEmpty in favor of EntityStore.hasEntity(). done

Features:

  • Add async support to persistState so it will work with IndexedDB etc. done
  • Add akitaPreUpdateEntity and akitaPreAddEntity middlewares to EntityStore. done
  • Add akitaPreUpdate middleware to Store. done
  • Add caching functionality that exposes API like: this.query.getHasCache(), this.query.selectHasCache() with ability to define a ttl. done
  • Add support for event-based APIs like websockets. We've added the following functionality:
 import { runStoreAction, StoreActions } from '@datorama/akita';

 runStoreAction('books', StoreActions.UpdateEntities, {
   payload: {
     data: { title: 'New title' },
     entityIds: 2
   }
 });

done

enhancement help wanted

All 12 comments

Great news.
Regarding

  • Remove array helpers. done

How would arrays be handled then? (specifically remove specific index etc.)

@danzrou you can include what you need in your application and use it. We can't find any reason that we should include it inside Akita.

https://github.com/georapbox/immutable-arrays

Seems totally legit.

Would love the new caching functionality <3

Amazing news, but i still waiting class support.

@NetanelBasal It's working only if we pass object in constructor

As their are a lot of break changes. You could also rename all Plug in to have Akita in the name :

PaginatorPlugin -> AkitaPaginatorPlugin
StateHistoryPlugin -> AkitaStateHistoryPlugin
DirtyCheckPlugin -> AkitaDirtyCheckPlugin
persistState() -> AkitaPersistState()
PersistNgFormPlugin -> AkitaPersistNgFormPlugin (maybe for this : "AkitaNgPersistFormPlugin" to have better corresponding with other ng plugin.

Did you provide a version 2.x with all deprecated feature, and new feature, to help the migration !?

Thanks for the suggestion. We're planning bigger changes in the plugins area, so we'll do it in that time.

runStoreAction and StoreActions are not exported in src/index.ts so there are not usable.

Worth noting that if you're using forkJoin to fetch from your api, of() would short-circuit it. Either do of(null) or pipe(defaultIfEmpty())

@MarcelMalik fixed. @jonchai99 you're right, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hoisel picture hoisel  路  5Comments

hoisel picture hoisel  路  5Comments

twittwer picture twittwer  路  7Comments

stephencarr picture stephencarr  路  4Comments

NathanAlcantara picture NathanAlcantara  路  4Comments