- Removed
includeStateChangesOnSubscribesetting. This was deprecated in v2.1.0. UsestateWithPropertyChangesorglobalStateWithPropertyChangesinstead. - ES2022 build target. The library now targets ES2022, which means it requires a modern JavaScript runtime. Older bundlers that cannot handle native classes (e.g., Angular 15's webpack) are no longer supported. If you need Angular 15 support, stay on v2.x.
- Dual ESM + CJS output. The package now ships both ES module (
observable-store.js) and CommonJS (observable-store.cjs) builds via theexportsfield inpackage.json. Most bundlers will resolve this automatically.
destroy()method. Calldestroy()on a service to unregister it from the global store and complete its state dispatchers. This prevents memory leaks when services are created and destroyed dynamically (e.g., in Angular'sngOnDestroy).- Deep cloning for complex objects. Objects with custom prototypes (Dayjs, Moment.js, Luxon DateTime, etc.) are now cloned correctly using a 4-strategy cascade:
clone()→ constructor →Object.create→ reference fallback. Previously,JSON.parse(JSON.stringify())would strip prototype methods and corrupt these objects. (Fixes #314) - Deep Map/Set cloning. Map and Set values are now individually deep-cloned rather than shallow-copied, preventing mutation leaks across state snapshots.
- Vite build system. Replaced
tscwith Vite library mode for building bothobservable-storeandobservable-store-extensions. - Vitest test framework. Replaced Jasmine with Vitest. 103 tests run in ~50ms.
- TypeScript 5.8. Upgraded from TypeScript 4.9.
- Reduced dev dependencies. From 8 to 4 (removed jasmine, ts-node, @types/jasmine, @types/node).
- Code quality.
hasOwnProperty()→Object.hasOwn(),var→const,==→===, removed dead imports, reduced redundant cloning insetState().
All sample applications have been upgraded to current framework versions:
- Angular: 15 → 21 (standalone components,
@if/@forcontrol flow,provideZoneChangeDetection) - React: 16 → 19 (hooks, React Router v7, Vite)
- Vue: 2 → 3.5 (Composition API, Vue Router v4, Vite)
- JavaScript: webpack → Vite
@codewithdan/observable-store-extensionshas been modernized with Vite + TypeScript 5.8 and ships dual ESM/CJS builds matching the core library.
- New
isStoreInitializedproperty. Thanks to Jason Landbridge.
- Added
getStateSliceProperty()function. Thanks to Connor Smith.
- Fixed internal cloning to respect
deepCloneparameter. Thanks to Steve-RW.
- Added Map and Set cloning support. Thanks to Chris Andrade.
- Added Redux DevTools extension (
@codewithdan/observable-store-extensions). - Added
allStoreServicesproperty andaddExtension()function.
- Added
stateWithPropertyChangesandglobalStateWithPropertyChangesobservables. - Deprecated
includeStateChangesOnSubscribe.
- Strongly-typed API.
- RxJS moved to peer dependency.
- Added
globalSettings. - Added cloning for state immutability.