Comments (3)
I wonder whether it's possible to include in the error message which action dispatched to the store/reducer causes the error?!?
from ngrx-store-freeze.
Solved as usage failure / implementation error
Previous reducer:
case Types.FETCH_MAPPING_SUCCESS: {
const mappings = state.mappings;
mappings[action.payload.version] = action.payload;
return {
...state,
mappings
};
}
Accessed mappings from the state which are frozen objects. Solved with destructuring:
case Types.FETCH_MAPPING_SUCCESS: {
const mappings = { ...state.mappings };
mappings[action.payload.version] = action.payload;
return {
...state,
mappings
};
}
from ngrx-store-freeze.
This error is super misleading. There should be something in the error message that states something like "hey, code monkey. You can't update something in the store directly". Spent hours trying to figure out what could be causing this issue only to find out it's because I was doing this:
on(ApplicationActions.toggleCollapseNavGroup, (state, group: INavGroup ) => {
const navGroup = state.allNavGroups.find( g => g.groupId === group.groupId);
navGroup.collapsed = !navGroup.collapsed;
return { ...state };
})
btw, I tried destructuring trick. It did not work. Same error.
const navGroups = [ ...state.allNavGroups ];
const navGroup = navGroups.find( g => g.groupId === group.groupId);
navGroup.collapsed = !navGroup.collapsed;
return { ...state, allNavGroups: navGroups };
But if I do this, it works:
const navGroups = state.allNavGroups.map(g => ({ ...g }));
from ngrx-store-freeze.
Related Issues (20)
- Update to NgRx 4 HOT 22
- Project Adoption HOT 4
- Document in README how to create custom RouterStateSerializer HOT 1
- Cannot freeze array buffer views with elements HOT 1
- Freezing the payload can make application crash, expecially with RouterStore HOT 2
- Incorrect example in readme HOT 6
- wrongly freeze when an object which has a getter is in the store HOT 1
- Update Peer Dependency to NgRx 5.x
- The objects are getting frozen too soon HOT 7
- Should the storeFreeze replace an undefined state with an empty object?
- ngrx store freeze error HOT 3
- This library assumes that all Action's will have a 'payload' attribute HOT 1
- Why not use in production? HOT 1
- ngrx v6 compatibility HOT 3
- npm WARN [email protected] requires a peer of @ngrx/store@>=4.0.0 but none is installed. You must install peer dependencies yourself. HOT 1
- Required Ngrx/store version 6.0.0-beta.1 HOT 1
- [Notice] This package will no longer be needed as of NgRx version 8
- Using isDevMode() throws error Function calls are not supported in decorators but 'isDevMode' was called in 'metaReducers'
- Cannot add property _resolvedData, 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 ngrx-store-freeze.