@ngneat/elf-state-history
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -5,2 +5,11 @@ # Changelog | ||
## [1.2.1](https://github.com/ngneat/elf/compare/state-history-1.2.0...state-history-1.2.1) (2022-08-09) | ||
### Bug Fixes | ||
* **state-history:** fix `EntitiesStateHistory` to make it consider initial entities ([#309](https://github.com/ngneat/elf/issues/309)) ([e78a364](https://github.com/ngneat/elf/commit/e78a36410f5b2a2f772fa0da8cf68f9319c4857e)) | ||
# [1.2.0](https://github.com/ngneat/elf/compare/state-history-1.1.0...state-history-1.2.0) (2022-08-05) | ||
@@ -7,0 +16,0 @@ |
16
index.js
import { isFunction, coerceArray, filterNil, isUndefined } from '@ngneat/elf'; | ||
import { BehaviorSubject, map, pairwise, filter as filter$1 } from 'rxjs'; | ||
import { BehaviorSubject, map, startWith, pairwise, filter as filter$1 } from 'rxjs'; | ||
import { distinctUntilChanged, filter } from 'rxjs/operators'; | ||
import { selectEntities, getEntitiesIds, upsertEntities, selectEntity } from '@ngneat/elf-entities'; | ||
import { selectEntities, upsertEntities, selectEntity, getEntitiesIds } from '@ngneat/elf-entities'; | ||
@@ -217,3 +217,13 @@ class StateHistory { | ||
} else { | ||
this.subscription = this.store.pipe(selectEntities(this.entitiesRef), map(() => this.store.query(getEntitiesIds(this.entitiesRef))), pairwise()).subscribe(([prevEntities, currentEntities]) => { | ||
const getIds = () => { | ||
var _this$store$query; | ||
return (_this$store$query = this.store.query(getEntitiesIds(this.entitiesRef))) != null ? _this$store$query : []; | ||
}; | ||
this.subscription = this.store.pipe(selectEntities(this.entitiesRef), map(getIds), startWith(getIds()), pairwise()).subscribe(([prevEntities, currentEntities]) => { | ||
if (!prevEntities.length && !currentEntities.length) { | ||
return; | ||
} | ||
const currentIdsMap = new Set(currentEntities); | ||
@@ -220,0 +230,0 @@ const allChangedIdsMap = new Set([...prevEntities, ...currentEntities]); |
{ | ||
"name": "@ngneat/elf-state-history", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "State history management for elf store", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21666
604
0