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.
EntityStore.set() - remove options param, i.e entityClass. done.EntityStore.createOrReplace() in favor of EntityStore.upsert(). doneEntityStore.updateRoot() in favor of EntityStore.update(). doneEntityStore.updateAll() in favor of EntityStore.update(null, newState), doneStore.setState is internal and changed to _setState() - use only the update() method. donemapWorker. doneQuery.selectOnce - use select().pipe(take(1)). doneQuery.getSnapshot(). donenoop - use the of() observable. doneisPristine and isDirty in favor of new caching functionality. doneaction decorator takes the action name instead of an object. doneEntityStore.isEmpty in favor of EntityStore.hasEntity(). donepersistState so it will work with IndexedDB etc. doneakitaPreUpdateEntity and akitaPreAddEntity middlewares to EntityStore. doneakitaPreUpdate middleware to Store. donethis.query.getHasCache(), this.query.selectHasCache() with ability to define a ttl. donewebsockets. We've added the following functionality: import { runStoreAction, StoreActions } from '@datorama/akita';
runStoreAction('books', StoreActions.UpdateEntities, {
payload: {
data: { title: 'New title' },
entityIds: 2
}
});
done
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.
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.