Giter VIP home page Giter VIP logo

store's Introduction

angular-redux2/store

Angular-redux2/store is a powerful library for building Angular applications with Redux. Redux is a state management pattern that has become very popular in the JavaScript community for its simplicity and predictability. It provides a single source of truth for your application's state and uses a unidirectional data flow to manage data changes.

Angular-redux2/store builds upon Redux to provide seamless integration with Angular. It provides a set of services and decorators that make it easy to manage your application's state and bind it to your Angular components.

Discord npm version downloads per month

support

We currently provide support for Angular versions 14 and 15, as well as Redux version 4.2.1 and RxJS version 7.8.0. In the near future, our support will be extended to include backwards compatibility with RxJS version 7.5.0, and support for Angular versions 12 and 13, while continuing to support Redux version 4.2.1.

Changes from @angular-redux/store

Please note that function names have been changed in this version of the library (as it is a new codebase). You'll need to adjust accordingly when using it, e.g. select => Select, with substore => Substore, dispatch => Dispatch etc.

Getting Started

Plugins

Resources

Hacking on angular-redux/store

Want to hack on angular-redux2/store or any of the related packages? Feel free to do so, but please test your changes before making any PRs. Here's how to do that:

  1. Write unit tests. You can check that they work by running ng test.
  2. Run the linter. If your editor doesn't do it automatically, do it manually with ng lint.

store's People

Contributors

garefild avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

store's Issues

missing testing structure

It seems like you are missing the /store/testing part of the original library including MockNgRedux and NgReduxTestingModule.
Any chance you could and those back in?

Tests fail when using coverage flag and `getSelectorStub`

This is a...

  • bug report

What toolchain are you using for transpilation/bundling?

  • @angular/cli

Environment

NodeJS Version: 16.13
Typescript Version: 4.5.4
Angular Version: 13.1.2
@angular-redux/store version: 2.1.3
@angular/cli version: (if applicable) 13.1.3
OS: mac and ubuntu

Link to repo showing the issue

(optional, but helps a lot)
https://github.com/IsraelHikingMap/Site/tree/main/IsraelHiking.Web

Expected Behaviour:

Test should pass allways

Actual Behaviour:

When using coverage report and mocking a @select in the test the test fail since it doesn't find the right selector.
When I debug this I see the following problem:
The key is: "(state) => state.routes.present" but it can't be found since the coverage is wrapping this functionality changing the key name (I'm using functions to avoid incorrect spelling of hardcoded strings).
image

The following is my selector:
https://github.com/IsraelHikingMap/Site/blob/a629f410f543739084396a0431247ba0d06d1359/IsraelHiking.Web/src/application/services/layers/routelayers/selected-route.service.ts#L41
The following is the test that fails when using coverage:
https://github.com/IsraelHikingMap/Site/blob/a629f410f543739084396a0431247ba0d06d1359/IsraelHiking.Web/src/application/services/layers/routelayers/selected-route-service.spec.ts#L41

Stack Trace/Error Message:

No error, just the test fails

Additional Notes:

(optional)
Also worth noting that when using the same selector in the test but without () i.e.

                state => state.routes.present // note here - no () around state
            );

The test also fails, which means this getSelectorStub is very fragile...

I'll see if I can somehow improve the robustness of getSelectorStub, but I can't promise much, any help would be appreciated...

Cannot read properties of null if state is proxied

Hi, im trying to migrate from @angular/redux to this new version.

Everything worked fine after some dependency upgrades.
I'm using at the moment:

  • angular 15.2.10
  • node 18.10.X
  • redux 4.2.1
  • RxJs 7.8.0
  • @angular-redux2/core 5.0.2

When launching the application an error is raised after my state has become a proxy of my state.

error.handler.ts:16 Error: Uncaught (in promise): TypeError: Cannot read properties of null (reading '_isProxy')
TypeError: Cannot read properties of null (reading '_isProxy')
    at Object.get (angular-redux2-store.mjs:145:71)
    at checkoutReducer (checkout.reducer.ts:68:28) // <- my reducer
    at combination (redux.js:560:29)
    at ReducerService.produce (angular-redux2-store.mjs:164:28)
    at angular-redux2-store.mjs:64:29
    at next (angular-redux2-store.mjs:118:20)
    at ReducerService.subStoreRootReducer (angular-redux2-store.mjs:106:16)
    at next (angular-redux2-store.mjs:118:20)
    at ReducerService.executeMiddlewareChain (angular-redux2-store.mjs:120:16)
    at angular-redux2-store.mjs:68:25
    at resolvePromise (zone.js:1193:31)
    at resolvePromise (zone.js:1147:17)
    at zone.js:1260:17
    at _ZoneDelegate.invokeTask (zone.js:402:31)
    at core.mjs:23896:55
    at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:23896:36)
    at _ZoneDelegate.invokeTask (zone.js:401:60)
    at Object.onInvokeTask (core.mjs:24197:33)
    at _ZoneDelegate.invokeTask (zone.js:401:60)
    at Zone.runTask (zone.js:173:47) '[object Error]'

Store initialization is exactyle the same as it's in the getting started page.
A StoreModule that has the ngRedux.configureStore call.
I already disabled devTools just in case, but the error keeps raising.

In this three screenshot you can see how the state is "proxied" after a particular redux action @@redux/PROBE_UNKNOWN_ACTION_*.

Before, that state is well typed
Screenshot from 2023-12-19 18-09-39

State is already proxied
Screenshot from 2023-12-19 18-09-47

My first action comes in and an error will raise
Screenshot from 2023-12-19 18-10-03

rxjs operators are incorrectly imported into the project and can't be compiled

Hello, Could you please update the imports from rxjs library?

  • feature request
  • [+ ] bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • [+ ] @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

Environment

NodeJS Version:
Typescript Version:
Angular Version:
@angular-redux/store version:
@angular/cli version: (if applicable)
OS:

Link to repo showing the issue

(optional, but helps a lot)

Expected Behaviour:

Correct imports from the library

Actual Behaviour:

Incorrect paths are used for rxjs library

Stack Trace/Error Message:

hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:364:53-56 - Error: export 'map' (imported as 'map') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:364:78-98 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:546:31-51 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:546:55-58 - Error: export 'map' (imported as 'map') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:546:80-100 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:1238:98-118 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
โœ” Browser application bundle generation complete.
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:364:53-56 - Error: export 'map' (imported as 'map') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:364:78-98 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:546:31-51 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:546:55-58 - Error: export 'map' (imported as 'map') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:546:80-100 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 | ./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:1238:98-118 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, GroupedObservable, NEVER, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrameScheduler, asapScheduler, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queueScheduler, race, range, scheduled, throwError, timer, using, zip)
hero3-main-hero_setup_runner-1 | hero_frontend_1 |
hero3-main-hero_setup_runner-1 | hero_frontend_1 |

Additional Notes:

(optional)

Errors after migrating to angular-redux2

I installed this library and upgraded to Angular 12 but it shows these errors. Any idea how to fix it?

ERROR LOG

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:10:0-53 - Error: Module not found: Error: Can't resolve 'broadcast-channel' in '/home/feenix/Public/ahub-portal/node_modules/@angular-redux2/store/fesm2015'

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:406:55-58 - Error: export 'map' (imported as 'map') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, NEVER, NotFoundError, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, SequenceError, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrame, animationFrameScheduler, animationFrames, asap, asapScheduler, async, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, connectable, defer, empty, firstValueFrom, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, lastValueFrom, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queue, queueScheduler, race, range, scheduled, throwError, timer, using, zip)

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:406:80-100 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, NEVER, NotFoundError, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, SequenceError, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrame, animationFrameScheduler, animationFrames, asap, asapScheduler, async, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, connectable, defer, empty, firstValueFrom, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, lastValueFrom, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queue, queueScheduler, race, range, scheduled, throwError, timer, using, zip)

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:595:31-51 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, NEVER, NotFoundError, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, SequenceError, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrame, animationFrameScheduler, animationFrames, asap, asapScheduler, async, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, connectable, defer, empty, firstValueFrom, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, lastValueFrom, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queue, queueScheduler, race, range, scheduled, throwError, timer, using, zip)

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:595:55-58 - Error: export 'map' (imported as 'map') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, NEVER, NotFoundError, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, SequenceError, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrame, animationFrameScheduler, animationFrames, asap, asapScheduler, async, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, connectable, defer, empty, firstValueFrom, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, lastValueFrom, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queue, queueScheduler, race, range, scheduled, throwError, timer, using, zip)

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:595:80-100 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, NEVER, NotFoundError, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, SequenceError, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrame, animationFrameScheduler, animationFrames, asap, asapScheduler, async, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, connectable, defer, empty, firstValueFrom, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, lastValueFrom, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queue, queueScheduler, race, range, scheduled, throwError, timer, using, zip)

./node_modules/@angular-redux2/store/fesm2015/angular-redux2-store.mjs:1371:9-29 - Error: export 'distinctUntilChanged' (imported as 'distinctUntilChanged') was not found in 'rxjs' (possible exports: ArgumentOutOfRangeError, AsyncSubject, BehaviorSubject, ConnectableObservable, EMPTY, EmptyError, NEVER, NotFoundError, Notification, NotificationKind, ObjectUnsubscribedError, Observable, ReplaySubject, Scheduler, SequenceError, Subject, Subscriber, Subscription, TimeoutError, UnsubscriptionError, VirtualAction, VirtualTimeScheduler, animationFrame, animationFrameScheduler, animationFrames, asap, asapScheduler, async, asyncScheduler, bindCallback, bindNodeCallback, combineLatest, concat, config, connectable, defer, empty, firstValueFrom, forkJoin, from, fromEvent, fromEventPattern, generate, identity, iif, interval, isObservable, lastValueFrom, merge, never, noop, observable, of, onErrorResumeNext, pairs, partition, pipe, queue, queueScheduler, race, range, scheduled, throwError, timer, using, zip)

Error: src/app/modules/routes/library-publishing/datasets/dataset/dataset-categories-tab/category-tree/category-tree.component.ts:53:10 - error TS2305: Module '"rxjs/internal/observable/ConnectableObservable"' has no exported member 'connectableObservableDescriptor'.

53 import { connectableObservableDescriptor } from "rxjs/internal/observable/ConnectableObservable";
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: src/app/modules/routes/library-publishing/exporters/exporter/exporter-mapping-tab/exporter-blueprint-tree/exporter-blueprint-tree.component.ts:370:44 - error TS2341: Property '_flattenedData' is private and only accessible within class 'MatTreeFlatDataSource<T, F, K>'.

370       const nodeToExpand = this.dataSource._flattenedData
                                               ~~~~~~~~~~~~~~




** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

MY DEPENDENCIES

"dependencies": {
		"@agentepsilon/decko": "^2.0.1",
		"@angular-redux2/store": "^4.0.4",
		"@angular/animations": "^12.2.17",
		"@angular/cdk": "^12.2.13",
		"@angular/common": "^12.2.17",
		"@angular/compiler": "^12.2.17",
		"@angular/core": "^12.2.17",
		"@angular/forms": "^12.2.17",
		"@angular/localize": "^12.2.17",
		"@angular/material": "^12.2.13",
		"@angular/material-moment-adapter": "^12.2.13",
		"@angular/platform-browser": "^12.2.17",
		"@angular/platform-browser-dynamic": "^12.2.17",
		"@angular/router": "^12.2.17",
		"@google/model-viewer": "^1.6.0",
		"@types/node": "^14.14.41",
		"@types/prettier": "^2.2.3",
		"ag-grid-angular": "^25.1.0",
		"ag-grid-community": "^25.1.0",
		"bootstrap-icons": "^1.5.0",
		"chart.js": "^2.9.4",
		"core-js": "^2.6.12",
		"crypto-js": "^4.0.0",
		"file-saver": "^2.0.5",
		"jwt-decode": "^3.1.2",
		"latest": "^0.2.0",
		"lodash": "^4.17.21",
		"moment": "^2.29.1",
		"ng2-charts": "^2.4.2",
		"ngx-clipboard": "~14.0.1",
		"ngx-cookie-service": "11.0.2",
		"ngx-infinite-scroll": "~10.0.1",
		"path": "^0.12.7",
		"redux": "^4.2.1",
		"redux-devtools-extension": "^2.13.8",
		"redux-observable": "^1.2.0",
		"rxjs": "^7.0.1",
		"stream": "0.0.2",
		"swagger-ui-dist": "^3.47.1",
		"timers": "^0.1.1",
		"ts-helpers": "1.1.2",
		"tslib": "^2.3.1",
		"url-polyfill": "^1.1.12",
		"url-search-params-polyfill": "^8.1.1",
		"zone.js": "~0.11.4"
	},
	"devDependencies": {
		"@angular-devkit/build-angular": "^12.2.18",
		"@angular-devkit/build-optimizer": "^0.1102.10",
		"@angular-eslint/builder": "12.7.0",
		"@angular-eslint/eslint-plugin": "12.7.0",
		"@angular-eslint/eslint-plugin-template": "12.7.0",
		"@angular-eslint/schematics": "12.7.0",
		"@angular-eslint/template-parser": "12.7.0",
		"@angular/cli": "^12.2.18",
		"@angular/compiler-cli": "^12.2.17",
		"@types/crypto-js": "4.0.1",
		"@types/file-saver": "^2.0.2",
		"@types/jasmine": "^3.6.9",
		"@types/jasminewd2": "^2.0.8",
		"@types/lodash": "4.14.168",
		"@typescript-eslint/eslint-plugin": "4.28.2",
		"@typescript-eslint/parser": "4.28.2",
		"codelyzer": "^6.0.1",
		"eslint": "^7.26.0",
		"husky": "^8.0.1",
		"jasmine-core": "~3.6.0",
		"jasmine-spec-reporter": "~6.0.0",
		"karma": "^6.1.2",
		"karma-chrome-launcher": "~3.1.0",
		"karma-coverage-istanbul-reporter": "~3.0.3",
		"karma-jasmine": "~4.0.1",
		"karma-jasmine-html-reporter": "^1.5.4",
		"prettier": "^2.7.1",
		"pretty-quick": "^3.1.3",
		"protractor": "~7.0.0",
		"source-map-explorer": "^2.5.2",
		"stylelint": "^13.11.0",
		"stylelint-config-recommended": "^3.0.0",
		"ts-node": "^9.1.1",
		"tslint": "~6.1.0",
		"typescript": "~4.3.5"
	},

Add `immer` to `createReducerFromClass`

This is a...

  • feature request
  • bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

Environment

NodeJS Version: 16
Typescript Version: 4.7
Angular Version:
@angular-redux/store version:
@angular/cli version: (if applicable)
OS:

Additional Notes:

Since creating a reducer from a class already generates code it can be super beneficial to introduce immer there and allow the developer to reduce the boilerplate code even further.

This is used in redux-toolkit verify similar to how it's done here...

Let me know if this is something you would like me to push forward by sending a PR

Add handy helpers

The following code is what I use in my project to improve readability and maintenance:

import { Action } from "redux";
/**
 * This is a type definition to for the decorator
 */
type ReduxActionDescriptor = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;

/**
 * This is a simple helper to allow creating typed actions with payload 
 */
export abstract class BaseAction<TPayload> implements Action {
    constructor(public type: string, public payload: TPayload) { }
}

/**
 * This middleware can be used to send classes instead of objects by copy only the data
 */
export const classToActionMiddleware = (state: any) => (next: any) => (action: any) => next({ ...action });

/**
 * This descriptor allows converting a method in a class to a function in a reducer
 * Use it above a mothed you would like to convert to a reducer function like so:
 * @ReduxAction(SOME_ACTION_TYPE)
 * public someMethod(...) { ... }
 */
export const ReduxAction = (type: string): ReduxActionDescriptor => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
            descriptor.value.type = type;
        };

/**
 * This utility method takes a class and converts it to a reducer
 * It allows writing a class to allow easy reusability 
 */
export const createReducerFromClass = <State>(reducer: new () => any, initialState: State) => {
    const instance = Object.create(reducer.prototype);
    return (lastState: State = initialState, action: Action): State => {
        for (let fn in instance) {
            if (typeof instance[fn] === "function" && (instance[fn] as any).type === action.type) {
                return instance[fn].apply(instance, [lastState, action]);
            }
        }
        return lastState;

    };
};

I think it should be split to a few files and exported in index.ts file.
I don't mind sending a pull request if you let me know where would you like each functionality.

If this can be integrated in this lib I can take it and use it in my project, otherwise I'll need to add this file to my project like it was before which I would like to avoid.

License change from MIT to GPLv3

I noticed that version 4.0.4 was released under MIT license and the new version 5.x updated the license to GPLv3.
Is the new upcoming release no longer be licensed under MIT conditions?

@select returns multiple values without the store values actually changing

This is a bug report

I've just switched from @angular-redux/store": "~10.0.0" to @angular-redux2/store": "~2.1.3",.
I did no changes to the code except changing the imports.
Following code with @select started to return 2 values (first false then true). The previous store returned only true.

@Injectable()
export class IsLoggedInAuthGuard implements CanActivate {

  @select([ 'auth', 'isLoggedIn' ]) isLoggedIn$: Observable<boolean>;

  constructor(private router: Router,
              private authActions: AuthActions) {}

  canActivate(route: ActivatedRouteSnapshot,
              state: RouterStateSnapshot): Observable<boolean> {

    return this.isLoggedIn$
      .pipe(
        tap(data => console.log('IsLoggedInAuthGuard tap', data)),
        tap(logged => {
          if (!logged) {
            this.authActions.saveRedirectUrl(state.url);
            this.router.navigate([ '/logowanie' ]);

            console.log('IsLoggedInAuthGuard', logged);
          }
        })
      );
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.