Commit aa863370 authored by Grandschtroumpf's avatar Grandschtroumpf

fix initial state

parent 49ed5d9d
...@@ -85,7 +85,7 @@ export class EntityStore extends Store { ...@@ -85,7 +85,7 @@ export class EntityStore extends Store {
static fromLocal (name, keyId, initialState = {}) { static fromLocal (name, keyId, initialState = {}) {
const fromLocal = localStorage.getItem(name) const fromLocal = localStorage.getItem(name)
const intial = fromLocal ? JSON.parse(fromLocal) : initialState const intial = fromLocal ? JSON.parse(fromLocal) : initialState
return new EntityStore(name, keyId, intial || { ids: [], actives: [] }) return new EntityStore(name, keyId, intial)
} }
/** /**
...@@ -94,7 +94,7 @@ export class EntityStore extends Store { ...@@ -94,7 +94,7 @@ export class EntityStore extends Store {
* @param {(string|number)} keyId The name of the key used as a unique ID for the entity * @param {(string|number)} keyId The name of the key used as a unique ID for the entity
* @param {EntityState} initialState The initial state used if state is not available in `localStorage` * @param {EntityState} initialState The initial state used if state is not available in `localStorage`
*/ */
constructor (name, keyId, initialState) { constructor (name, keyId, initialState = { ids: [], actives: [], entities: {} }) {
super(name, initialState) super(name, initialState)
this.keyId = keyId || 'id' this.keyId = keyId || 'id'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment