Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tap((nextState) => {
for (const [provider] of this.entries) {
const prevData: Any = getValue(states, provider.path);
const newData: Any = getValue(nextState, provider.path);
if (prevData !== newData || isInitAction) {
const engine: DataStorageEngine = this.exposeEngine(provider);
try {
const data: Any = this.serialize(newData, provider);
const key: string = this.ensureKey(provider);
engine.setItem(key, data);
NgxsDataStorageEngine.keys.set(key);
} catch (e) {
console.error(`${NGXS_DATA_EXCEPTIONS.NGXS_PERSISTENCE_SERIALIZE}:::${provider.path}`);
}
}
}
})
);
tap((nextState) => {
for (const [provider] of this.entries) {
const prevData: Any = getValue(states, provider.path);
const newData: Any = getValue(nextState, provider.path);
if (prevData !== newData || isInitAction) {
const engine: DataStorageEngine = this.exposeEngine(provider);
try {
const data: Any = this.serialize(newData, provider);
const key: string = this.ensureKey(provider);
engine.setItem(key, data);
NgxsDataStorageEngine.keys.set(key);
} catch (e) {
console.error(`${NGXS_DATA_EXCEPTIONS.NGXS_PERSISTENCE_SERIALIZE}:::${provider.path}`);
}
}
}
})
);
msg => {
const type = getValue(msg, config.typeKey);
if (!type) {
throw new Error(`Type ${type} not found on message`);
}
store.dispatch({ ...msg, type });
},
err => store.dispatch(new WebsocketMessageError(err)),
return this._store.select(state => getValue(state, path)).pipe(takeUntil(this._destroy$));
}
next: (message: any) => {
const type = getValue(message, this.typeKey);
if (!type) {
throw new TypeKeyPropertyMissingError(this.typeKey);
}
this.store.dispatch({ ...message, type });
},
error: (error: any) => {
.selectOnce(state => getValue(state, this.path))
.subscribe(() => {