salesforce / akita Goto Github PK
View Code? Open in Web Editor NEWπ State Management Tailored-Made for JS Applications
Home Page: https://salesforce.github.io/akita/
License: Apache License 2.0
π State Management Tailored-Made for JS Applications
Home Page: https://salesforce.github.io/akita/
License: Apache License 2.0
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Support request
[ ] Other... Please describe:
i'm using the Akita in app with universal rendering and i got error when i try to start the server.
> dist\server.js:209400 storage: localStorage, ^ ReferenceError: localStorage is not defined at Object.<anonymous> (dist\server.js:209400:14) at __webpack_require__ (dist\server.js:20:30) at Object.@datorama/akita (dist\server.js:132101:18) at __webpack_require__ (dist\server.js:127767:30) at Object../src/app/state/app-state.query.ts (dist\server.js:131374:15) at __webpack_require__ (dist\server.js:127767:30) at Object../src/app/state/index.ts (dist\server.js:131587:10) at __webpack_require__ (dist\server.js:127767:30) at Object../src/app/app.component.ts (dist\server.js:128687:15) at __webpack_require__ (dist\server.js:127767:30)
I don't use localStorage and persistState. I would appreciate some tips on how to make my app work ^^
Angular version: 6.1.3
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
I use persistState to persist store state through page refreshs (i.e auth token). After first page refresh, store state gets loaded correctly in memory (store), but local storage is replaced by store initial state. After a second refresh, both memory and local store contains initial state.
State in local storage remain over multiple pages refreshs
Source code here
Angular version: 5.2.6
Browser:
- [X] Chrome (desktop) version 67.0.3396.99 (64 bits)
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.11.1
- Platform: Linux Mint
edit: I just realized, this isn't the best example, because you could already have the needed index in the tags
EntityState. But you get the gist.
Example: you might want to look up items by a tag that's attached to it. Say we have an EntityStore with items
where each item can have one or several tags (by id, assume a normalized state).
const items = [
{id:1, tags: [1, 2]},
{id:2, tags: [1]}
{id:3, tags: [2, 3]}
];
The resulting State looks like this:
{
entities: {
1: {id:1, tags: [1, 2]},
2: {id:2, tags: [1]}
3: {id:3, tags: [2, 3]}
},
ids: [1,2,3]
}
Filtering or finding items by tag is cumbersome and slow. It'd be nice to get the possibility of indexing items by one or more keys different from id
to get a state similar to this one:
{
entities: {
1: {id:1, tags: [1, 2]},
2: {id:2, tags: [1]}
3: {id:3, tags: [2, 3]}
},
entitiesByTag: {
1: [1, 2], // just the ids for brevity, actual entities should be here
2: [1, 3],
3: [3]
},
ids: [1,2,3]
}
Implementing this reactively isn't feasible as you'd have to either diff or reindex the entire thing on every state change.
[x] Feature request
As of now users have to manage ids on their own.
Opt in or configurable automatic id creation. (or opt-out and configurable but this would introduce a breaking change)
This would make the framework even more easy to use if you're not using custom IDs.
[ ] 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:
export interface EntityState<E> {
...
error: any;
}
export interface EntityState<E, TError = any> {
...
error: TError;
}
correct error typing
[ ] 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:
It'd be great if we could update and remove items from the store based on anything else but IDs.
The overloads that would be added would look something like:
update(predicate: ((entity: Readonly<E>) => boolean), newStateFn: ((entity: Readonly<E>) => Partial<E>));
update(predicate: ((entity: Readonly<E>) => boolean), newStateFn: Partial<E>);
update(predicate: ((entity: Readonly<E>) => boolean), newState: Partial<S>);
this would allow to write this:
renameAllNicks() {
this.update(e => e.name === 'Nick', { name: 'Bob' });
}
I understand that the same result could be achieved with this:
this.update(null, e => e.name === 'Nick' ? { ...e, name: 'Bob' } : e);
...but, that looks more verbose (and this is a very simple example).
Things are a bit worse for the remove case. Instead of proposed suggestion:
this.remove(e => e.name === 'Nick');
...today's solution would have to be the following:
const idsToRemove = [];
for (const id in this.entities) {
if (this.entities[id].name === 'Nick') {
idsToRemove.push(id);
}
}
this.remove(idsToRemove);
I could take a stab at this and submit a PR if you give me a "good to go".
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
How about a blog post (or a recipe in the documentation, or just a couple of tips) which describes managing access rights, roles, and user groups using Akita? Would be great to see something like that.Thx :)
Hello Akita Team, where can i found and download the source code for your sample application at http://akita.surge.sh/?
I read also this great post 'The Complete Guide to Authentication in Angular with Akita'
The source code of the post sample application could probably help me since I need to implement first the security using JWT. This is probably already implemented in your sample application at http://akita.surge.sh/.
Thanks!
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
EntityStore does not handle updating entity's id key correctly
The following test should pass:
it('should update entity id', () => {
store.add(new Todo({ id: 1 }));
store.update(1, { id: 2 });
expect(store.entities[2].id).toEqual(2);
expect(store._value().ids).toEqual([2]);
});
I have a usecase of optimistic add/update functionality. The code looks like this:
CategoriesService
:
addCategory(name: string) {
const dirtyId = this.categoriesStore.optimisticAdd(name);
this.api.addCategory(name).subscribe(
res => this.categoriesStore.updateOptimistic(dirty, res.id),
err => {
console.error(err);
this.categoriesStore.deleteOptimistic(dirty);
}
);
}
CategoriesStore
:
optimisticAdd(name: string) {
const category = { id: -1, name, dirty: uuid() };
this.add(category);
return category.dirty;
}
updateOptimistic(dirty: string, categoryId: number) {
this.update(e => e.dirty === dirty, { id: categoryId });
}
deleteOptimistic(dirty: string) {
this.remove(e => e.dirty === dirty);
}
Akita should support updating entity ids to enable use cases like the one described above.
I already fixed issue locally and can send a PR if you don't have any concerns.
That's what I imagine:
@Component({
template: `
<div class="container">
<tweet *ngFor="let tweet of infiniteScroll.data$"></tweet>
<spinner *ngIf="infiniteScroll.loading$"></spinner>
</div>
`
})
export class TweetsComponent {
tweets: InfiniteScrollPlugin<Tweet>;
constructor(private tweetsQuery: TweetsQuery) { }
ngOnInit() {
const request = ({ page }) => this.tweetsService.getTweets(page);
this.tweets = new InfiniteScrollPlugin(this.tweetsQuery, { container: '.container', offset: 30, request })
}
}
The plugin responsibilities are:
data$
key.Need to do research and check if there is a standard server response for infinite scroll APIs.
The motivation is clear. Almost every application needs an infinite scroll functionality today.
I'd love to hear your opinion and know if anyone wants to take it.
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
package.json
file.A package.json file at the root of your project is required to release on npm.
Please follow the npm guideline to create a valid package.json
file.
Good luck with your project β¨
Your semantic-release bot π¦π
[x] Bug report
Compiling with TS 2.9.2 impossible due to type errors:
node_modules/@datorama/akita/src/api/entity-store.d.ts(84,5): error TS2416: Property 'update' in type 'EntityStore<S, E>' is not assignable to the same property in base type 'Store<S>'.
Type '{ (newState: Partial<S>): any; (id: string | number | (string | number)[], newStateFn: ((entity: ...' is not assignable to type '{ (newState: Partial<S>): any; (id: string | number | (string | number)[], newState: Partial<S>):...'.
Types of parameters 'newState' and 'id' are incompatible.
Type 'string | number | (string | number)[]' is not assignable to type 'Partial<S>'.
Type 'string' is not assignable to type 'Partial<S>'.
node_modules/@datorama/akita/src/api/entity-store.d.ts(85,5): error TS2416: Property 'update' in type
'EntityStore<S, E>' is not assignable to the same property in base type 'Store<S>'.
Type '{ (newState: Partial<S>): any; (id: string | number | (string | number)[], newStateFn: ((entity: ...' is not assignable to type '{ (newState: Partial<S>): any; (id: string | number | (string | number)[], newState: Partial<S>):...'.
node_modules/@datorama/akita/src/api/query-entity.d.ts(16,15): error TS2416: Property 'store' in type 'QueryEntity<S, E>' is not assignable to the same property in base type 'Query<S>'.
Type 'EntityStore<S, E>' is not assignable to type 'Store<S>'.
Types of property 'update' are incompatible.
Type '{ (newState: Partial<S>): any; (id: string | number | (string | number)[], newStateFn: ((entity: ...' is not assignable to type '{ (newState: Partial<S>): any; (id: string | number | (string | number)[], newState: Partial<S>):...'.
Types of parameters 'newState' and 'id' are incompatible.
Type 'string | number | (string | number)[]' is not assignable to type 'Partial<S>'.
Type 'string' is not assignable to type 'Partial<S>'.
Compiling possible ;)
Create instances of EntityStore and QueryEntity and try to compile your code with TS 2.9.2 installed
Angular version: 6.1.0
TS: 2.9.2
First, congratulations! Very good. Just one question. Why not unify "Query" and "Store"? I mean make Query methods available on the store (select, etc). It seems strange for me to have 2 services, 1 to change and hold state (Store) and another (Query) to listen for modifications made in the first one (store). Currently these 2 services have to be injected in each place that have operations to change/listen to the state for changes. What is the point I am missing ?
[X ] Feature request
import { Todo } from './todo.model';
import { EntityState, EntityStore } from '@datorama/akita';
export interface State extends EntityState<Todo> {}
@Injectable({
providedIn: 'root'
})
export class TodosStore extends EntityStore<State, Todo> {
constructor() {
super(initialState);
}
}
import { Todo } from './todo.model';
import { EntityStore } from '@datorama/akita';
@EntityStore(Todo)
export class TodosStore {
//Custom store methods
//The store could wrap the service instead of a service wrapping the store
}
//Akita IOC Container provides the stores
let todosStore:TodosStore = AkitaContainer.get(TodosStore);
//If needed initialize state
todosStore.initializeState(intialState);
//If needed initialize state
AkitaContainer.get(TodosStore).initializeState(intialState);
;
let todos$: Observable<Todo[]> = AkitaContainer.get(TodosStore).selectAll();
let todos$: Observable<Todo[]> = AkitaContainer.get(TodosStore).select(filter:Function);
let todo: Observable<Todo> = AkitaContainer.get(TodosStore).select(id:ID);
Thoughts?
[X] Regression (a behavior that used to work and stopped working in a new release)
persistState no longer present in '@datorama/akita'
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x] Support request
[ ] Other... Please describe:
Because of the barrel index files, I always get circular dependency warnings at compile time. Example:
movies/state/index.ts
imports movies/state/movies.service.ts
actors/state/actor.model.ts
via barrel actors/state/index.ts
actors/state/index.ts
imports actors/state/actors.query.ts
movies/state/movies.query.ts
via barrel movies/state/index.ts
Such cases are unfortunately very common and the barrel files create more unconviniences than they help. Have you encountered such cases and how do you go around with it? Do you just remove the barrel? Thanks!
PS. Are the missing line breaks around providedIn: 'root'
in the CLI for Store intentional?
PPS. Is there a slack/gitter room for asking such small questions?
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[X] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
This issue is just a question / potential request for clarifications in the docs.
The documentation provides examples where the transaction is applied to the methods in the same store. I poked around the code for @transaction
, but could not quite understand how it works. The question is whether it can be applied to actions in different stores. For example:
@transaction
actionAffectingTwoStores() {
this.storeOne.add({ name: 'asd' });
this.storeTwo.add({ name: 'qwe' });
}
Thanks for the awesome library.
Finally got around testing akita for a small project, a 2D map editor for a game. I'll keep you updated. Pretty excited ! π
What do you think about using @angular/schematics for the CLI ?
It's pretty simple and makes sense imo as this framework is coupled to the angular ecosystem.
There's a funny tutorial here.
Seems simple enough I can PR if you want !
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ X] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
When running ng serve --aot
with @datorama/akita-ngdevtools
configured like so...
@NgModule({
imports: [
....
AkitaNgDevtools.forRoot({ actionsBlacklist: ['@@INIT'] })]
})
export class AppModule {}
I receive the following error
ERROR in Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'factory' was called in 'AkitaNgDevtools'
'AkitaNgDevtools' calls 'factory'.
The dev tools work in AOT.
Add the dev tools package and run ng serve --aot
.
AOT brings a lot of benefits in validating templates and code while developing features. It would be nice to run the Akita dev tools while building with AOT.
Angular CLI: 6.1.2
Node: 10.8.0
OS: win32 x64
Angular: 6.1.1
... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
----------------------------------------------------------- @angular-devkit/architect 0.7.2
@angular-devkit/build-angular 0.7.2
@angular-devkit/build-optimizer 0.7.2
@angular-devkit/build-webpack 0.7.2
@angular-devkit/core 0.7.2
@angular-devkit/schematics 0.7.2
@angular/cli 6.1.2
@ngtools/webpack 6.1.2
@schematics/angular 0.7.2
@schematics/update 0.7.2
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2
Browser:
- [ X] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 10.8.0
- Platform: Windows
Others:
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Errors when compiling with option "strict": true
node_modules/@datorama/akita/src/api/query-config.d.ts(2,35): error TS7006: Parameter 'a' implicitly has an 'any' type. node_modules/@datorama/akita/src/api/query-config.d.ts(2,38): error TS7006: Parameter 'b' implicitly has an 'any' type. node_modules/@datorama/akita/src/enhancers/devtools.d.ts(9,17): error TS7006: Parameter 'state' implicitly has an 'any' type. node_modules/@datorama/akita/src/enhancers/devtools.d.ts(9,24): error TS7006: Parameter 'action' implicitly has an 'any' type. node_modules/@datorama/akita/src/plugins/dirty-check/dirty-check-plugin.d.ts(4,45): error TS7006: Parameter 'head' implicitly has an 'any' type. node_modules/@datorama/akita/src/plugins/dirty-check/dirty-check-plugin.d.ts(4,51): error TS7006: Parameter 'current' implicitly has an 'any' type. node_modules/@datorama/akita/src/plugins/dirty-check/dirty-check-plugin.d.ts(10,22): error TS7006: Parameter 'head' implicitly has an 'any' type. node_modules/@datorama/akita/src/plugins/dirty-check/dirty-check-plugin.d.ts(10,28): error TS7006: Parameter 'current' implicitly has an 'any' type.
And thanks for an awesome library. I really like its simplicity. I've been looking for something similar to this. I've been stuck in the complexity and boilerplate hell of ngrx/redux.
could be both, a bug or "working as intended"
Limiting is done before filtering, potentially resulting in an array shorter than limitTo
although more items of the source set might have met the filterBy
criterion.
The filtering loop should keep filtering items until the source array is exhausted or the result array has reached a length of limitTo
.
[_] Regression (a behavior that used to work and stopped working in a new release)
[_] Bug report
[_] Performance issue
[_] Feature request
[X] Documentation issue or request
[_] Support request
[_] Other... Please describe:
Hello. First of all, thank you guys for this amazing product.
Can you please write some examples or complete the documentation section about UI State.
Most interesting thing is how I can read/write UI state?
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[x] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
No examples in the docs about combining selectors in a memoized way.
There should be a mention of memoization / combination of selectors. There is a slight hint given in your article on working with normalized data (combineLatest
). Yet that still left me with a couple of question marks:
combineLatest
enough to provide an efficient memoized selector?auditTime
absolutely necessary and what kind of trick is auditTime(0)
?If both combineLatest
& auditTime
are needed in >90% of the cases, I would suggest creating a createSelector()
method that wraps everthing up for the user.
Minimizing the boilerplate in Query services and the deterrence across the audience with no deep understanding of RxJS.
Update:
After more digging I found the use case for auditTime(0)
. It's basically a performance boost in case of concurrent updates in the selectors being combined. Basically a substitute for @transaction
when the latter is not applicable. The following chart would be helpful in the docs if the team decides for not implementing a createSelector()
method:
https://user-images.githubusercontent.com/16118391/43370518-983476a0-9380-11e8-980c-828a8da819d0.png
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
On the documentation website, for the version 1.2.0 on the Blog Post section the article with Normalized data does not appear.
https://netbasal.gitbook.io/akita/entity-store/blog-posts
The article with Normalized data should appear also on the newer version.
This is how it looks like in v1.1.0
https://netbasal.gitbook.io/akita/v/1.1.0/entity-store/blog-posts
[x] Question regarding relations
all the documentation currently describes a 1:1 map of models and tables. If you were to have a customer->orders-orderline->[product, user, state] what would be the best practice for Akita ?
Should we have a store per model - how would you then link the relations together ? Is that done in the service - so should the customer service use the order service, or should it create a method to get the orders of the customer
Hello Akita Team I have another question before taking the AKITA path. Our new application will be responsible to configure IOT electronic devices (like NODE-RED) and display lots monitoring values (1000 updates /minutes) coming from these devices. As you stated previously Akita can take this load without any issue. Is our application is a good use case for using AKITA? I mean what AKITA store could bring as advantage over using regular services + RxJx.
Thanks you very much for your time :)
master
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can resolve this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
package.json
file.A package.json file at the root of your project is required to release on npm.
Please follow the npm guideline to create a valid package.json
file.
Good luck with your project β¨
Your semantic-release bot π¦π
[ ] 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:
Entity queries expose selectLoading()
so a component can toggle spinners while an http request is being made.
Queries for non-entities don't have this method and the non-entity stores don't maintain this state.
Non-entity queries and stores exposing loading
state/querying.
When I have sets of entities, entity stores/queries are great. But I often have single items I need to track state for (current session/user, a 'Detail' model of an entity that I'm editing) and I am usually making http requests to get this data from the api.
I would love to be able to query on this loading state for these non-entity collection stores.
I would be willing to help with a PR if you think this feature is worth adding, or if not I'm open to other ways of implementing it.
Thanks.
[x] Feature request
persistState({
exclude: [ 'test-store' ]
});
import { TestStore } from '---/state/test.store';
persistState({
exclude: [ TestStore ]
});
Using imports with class would make for a better development experience => compile time errors.
This is trivial to implement using metadata attached with @StoreConfig()
.
This could either lead to a breaking change if we now only take classes.
Or we could make the include
& exclude
arrays now take a string
or a class
as input and check on our end.
I think going for the second option and then going for the class only option in the next major release would be the best.
edit: would like to do a PR but npm hangs on a package because of the proxy at my company...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[x ] Other... Please describe:
if @StoreConfig({ name: 'products' })
is missing when you creating store (extends from EntityStore). It will throw this errror, that is not helpful
creating store file without @StoreConfig
sometime, new people like me forget to creating it.
[ ] 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:
function buildPath( name, chosenDir ) {
if(userPath) {
return `${userConfig}/${chosenDir}/state/${name}`;
}
return `${process.cwd()}/${chosenDir}/state/${name}`;
}
Currently the name of state directory is hardcoded in cli source code.
Please, add a possibility to specify the name of state directory :)
I want a possibility to create state directory with specified name w/o "state" directory inside using cli.
e.g.
/app/states/
widgets/widgets.store.ts
....
globals/globals.store.ts
...
etc.
Currently i must to do it manually.
Thx =)
[ ] 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:
Currently, you can configure how to sort your data by providing a sort function either in the @QueryConfig
or in select
query options.
That's awesome, but what if there is a case when you'd want to provide a custom sorting logic based on state. An API that would allow this would look something like this:
const sortBy: SortBy<CategoriesState, ICategory> =
(state) => (a, b) => state.sortByOrderNum ? (a.orderNum - b.orderNum) : a.name.localeCompare(b.name);
@QueryConfig({ sortBy })
Unfortunatelly I don't see how such change could be made via a non-breaking change as it's changing the SortBy
interface.
Make Akita more flexible
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
The docs says that, to user the sortByOrder in the QueryConfig decorator, I must import the Order enum like that:
import { Order } from '@datorama/akita';
But I get this error:
Module '"@datorama/akita/datorama-akita"' has no exported member 'Order'.
Visual Studio suggests importing from this path:
import { Order } from '@datorama/akita/src/internal/sort';
But, again, I get an error:
Module not found: Error: Can't resolve '@datorama/akita/src/internal/sort'
I'm using Akita version 1.3.1.
import { Order } from '@datorama/akita';
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[] Feature request
[ ] Documentation issue or request
[x] Support request
[ ] Other... Please describe:
What is the best way to include a store for a component that is going to be reused on different parts in the application and even coexist on the same view? I have a dashboard component that allows the user to create different kind of widgets. A store comes in handy to manage all the different actions and errors. However it kind of feels like I cannot do it with Atika.
[ ] 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:
Akita ngdevtools shows error if redux devtools does'nt installed in browser.
I think it would be nice to replace the error with a warning or an information message, because if, for example, I work in a team, but someone from the team does not want to use redux devtools, they get annoying error in the console. :)
Thx so much for the awesome library! :)
[ ] 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:
I am considering Akita for a fairly complex app and I seem to miss just a single puzzle piece in migrating from ngrx/ngxs - the router state. This plugin would address two important use cases in my view:
Would it fit well in Akita's infrastructure?
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
EntityStore does not apply the provided idKey in constructor and thus entities & ids are not treated correctly
It should accept the idKey given in constructor and treat it accordingly
EntityStore constructor:
constructor(private stylesDataService: StylesDataService) {
super([], {idKey: 'name'});
}
Checking the idKey of the store:
console.debug(
current store state =, this._value(), this.config,
idKey=${this.idKey});
Result:
{idKey: "id", storeName: "styles"} {idKey: "id"storeName: "styles" __proto__: Object} idKey=id
Angular CLI: 6.0.3
Node: 8.9.4
OS: win32 x64
Angular: 6.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.3
@angular/cdk 6.1.0
@angular/material 6.1.0
@ngtools/webpack 6.0.0
@schematics/angular 0.6.3
@schematics/update 0.6.3
rxjs 6.2.0
typescript 2.7.2
webpack 4.6.0
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[x ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Hello Akita Team, when I was looking at the documentation I detected a possible error on the documentation for sessions.model.ts for the createSession function (missing comma & missing timestamp parameter initialization). Double check me because, I'm still learning Akita and WebStorm is complaining and sometime it produce false warning.
export function createSession({
id = null, firstName = '', lastName = '', token = '', timestamp = new Date()
}: Partial) {
return {
id,
firstName,
timestamp,
lastName,
token
};
}
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[x ] Other... Please describe: Question
As I did not find related information in documentation, I'm not sure whether it was designed like this on purpose or not.
EntityStore removes all entities when entity id is 0.
In my case I have entities which are generated in app when the id is a sequence starting from 0.
I have modified it to start from 1 but brought this up only for your attention.
I guess its because of the following where id ?
returns false
remove(id?: ID | ID[], resetActive?) {
if (!toBoolean(id)) this.setPristine();
const ids = id ? coerceArray(id) : null;
this.setState(state => _crud._remove(state, ids, resetActive));
}
Version 1.1.0
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[x] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Running three actions of the same type in a row will always result in three updates of the store.
The ability to set an option that would cancel the execution of the previous action stream (switchMap behavior).
Maybe something like:
{ type: '[Todos] Fetch All', cancelUncompleted: true }
Clicking three times on the fetch button should normally not end up in three updates of the store.
I am not sure Akita can support this out of the box, but at least a documentation recipe of how can this be achieved with RxJS would be helpful.
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
I am sending a GET http request to an API endpoint to retrieve data from a MongoDB database with mongoose (MEAN stack).
The data received is always named with the name of the last entry of the collection.
The data should have the same name as the database data.
Compare the data display on the stackblitz and the API endpoint :
stackblitz : https://stackblitz.com/edit/angular-2qqqx4
API endpoint : https://dev-api.proforeigner.com/api/nationalities
I am not retrieving good data to display.
Angular version: 6.1.6
Browser:
- [x] Chrome (desktop) version 68.0.3440.106
For Tooling issues:
- Node version: v8.11.3
- Platform: Mac
Others:
MEAN stack with
- MongoDB v3.6.7
- Express v4.16.3
[ ] 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)
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
undo and redo accept only 1 ID
Should accept multilple IDs
According to documentation, EntityStateHistoryPlugin undo/redo should accept multiple IDs.
Akita 1.2.0
Why is this state manager better than NGRX? I have a choice. Thanks!
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Skills - @Transaction
gets displayed instead of the defined custom action in Redux DevTools. Neither @action
nor applyAction
does work.
Redux DevTools should display [Skills Service] Fetch All
.
https://stackblitz.com/edit/akita-todos-app-uiqjdx?file=src%2Fapp%2Fskills%2Fskills-data.service.ts
Am I doing it wrong by defining the custom action in the main service? It's the only place it makes sense for me. Thanks for your support!
[x ] Support request
When using persist state should the store not be set to pristine false, as its restored data from (in this case) local storage.
Hi, first congratulations for quick and new realease, I'm really hyped about it.
Going straight to the point, have you ever used and implemented a graphql endpoint with Apollo? The "problems" starts when using a state manager, such as NgRx, which case the apollo-angular developer is currently working on a solution to "merge" the two generated stores (NgRx and apollo). Yes, Apollo create it own inMemoryCache, creating a separate store.
Do you know a way of doing this? It's necessary? (since I do not know the internal things of Akita); If you're interested, should I make a request from this?
Thanks!
[x] Feature request
A function for EntityStore:
addAndSetActive(entity: E)
I think it is a pretty common use case to create an entity and set it as active right after.
In my case I'm creating an area in my map and the user then edits it.
[x] Bug report
After calling store.set()
, active
stays hydrated.
Maybe calling store.set()
should reset active
to null and then set entities for more robustness ?
By example, if we call store.set([])
, the id active
is pointing to won't exist anymore and could cause many bug.
Hello Is akita suitable for fast realtime monitoring of massive data update on the screen? Let say we receiving 1000 realtime values update per minutes and need to display changes on the web page using angular 5, can akita keep up with this situation.
Thanks for your time!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.