Comments (8)
developmentMode
recursively freezes the state. While the state after every action should be a new one, the action handlers use mutability while applying their logic. This is my guess.
I will look into it.
from entity-state.
What kind of entities do you have on your store? Can you paste your state class, including @State
annotation?
from entity-state.
As far as I can tell, there is nothing special about it.
The model is just a plain object.
@State<EntityStateModel<IFoo>>({
name: "foos",
defaults: defaultEntityState()
})
export class FooState extends EntityState<IFoo> {
constructor() {
super(FooState, "id", UUIDV1IdGenerator);
}
onUpdate(current: Readonly<IFoo>, updated: Partial<IFoo>): IFoo {
return {...current, ...updated};
}
}
The error message seems to indicate, that the problem happens when the entities
map is updated.
core.js:15714 ERROR TypeError: Cannot add property 930ec024-e23c-4d3a-91bd-619a6dbe7c0a, object is not extensible
at ngxs-labs-entity-state.js:1107
at Array.forEach (<anonymous>)
at FooState.push../node_modules/@foo/ngxs-labs-entity-state/fesm5/ngxs-labs-entity-state.js.EntityState._addOrReplace (ngxs-labs-entity-state.js:1103)
at FooState.push../node_modules/@foo/ngxs-labs-entity-state/fesm5/ngxs-labs-entity-state.js.EntityState.add (ngxs-labs-entity-state.js:777)
at StateFactory.push../node_modules/@ngxs/store/fesm5/ngxs-store.js.StateFactory.invokeActions (ngxs-store.js:1475)
at MergeMapSubscriber.project (ngxs-store.js:1401)
from entity-state.
What does IFoo
look like?
from entity-state.
It doesn't really matter, some interface with a id: string
and whatever else you want to add.
The problem occurs when an entity gets added to the entities
HashMap after EntityState.add
is invoked.
It would be good if there were some alpha/beta releases on NPM, didn't manage to add this stackblitz atm.
from entity-state.
@JanMalch This is fixed with #98?
from entity-state.
It will be, as soon as the refactor/immutability
branch is merged. It was planned to develop the entity state operators (#85) in there aswell. But I will create a PR for the branch now and open a new one for state operators.
from entity-state.
Hello @JanMalch @splincode ,
Can you update npm "@ngxs-labs/entity-state". I am getting the error.
Thank you
from entity-state.
Related Issues (20)
- Help request / question => how to get an entity by id? HOT 3
- Feature/Discussion: Collection Sort/Filter HOT 3
- Provide beta release? HOT 15
- Behaviour of remove action HOT 5
- Switch to Jest test framework
- EntityState selectors recalculate when any part of root state was updated HOT 7
- Joining Selectors of two EntityState not working
- Make pagination feature optional HOT 2
- Expose internal.ts to public to easily extend EntityState using same logic HOT 8
- Angular 9 upgrade blocked HOT 2
- Allow numbers as keys HOT 2
- Error: Attempted to get members of a non-class: class Add - NGCC HOT 3
- could not get librabry folder in my project HOT 3
- Adding Api Response to Entities HOT 3
- Change UMD Bundling from ES2015 to ES5? HOT 6
- [Feature request] IdStrategy with nested keys
- State of the library HOT 2
- Provide filter operators for actions e.g. ofEntityAction HOT 1
- Migrate to State Operators HOT 2
- Not working developmentMode, getting ERROR TypeError: Cannot add property VALUE_OF_ID, object is not extensible HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entity-state.