Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@rx-signals/angular-provider
Advanced tools
angular module for an opinionated @rx-signals/store integration
You can use this lib for an opinionated rx-signals integration into your Angular application.
npm install --save @rx-signals/angular-provider@3.0.0-rc4
If you have not yet installed the rx-signals store, please see @rx-signals/store documentation on how to install the latest 3.x version of that peer-dependency.
The standard-case should be to use a single Store
instance over your whole application.
In the topmost module that should use the store (AppModule, SharedModule, CoreModule, or whatever it is for you), you can just import RxSignalsStoreModule
.
This will provide a Store
singleton everywhere (so even lazy-loaded feature-modules will receive the same instance).
Instead, if you have functions performing setup with the store ((store: Store) => void
), you can use RxSignalsStoreModule.withRootStore()
, passing as many of those setup-functions as arguments as you like.
You can also use RxSignalsStoreModule.withRootStore()
in your feature-modules (whether lazy or not) to pass corresponding setup-functions of those feature-modules.
You might be used to modules that come with
forRoot()
andforFeature()
functions. These names make no sense in case of the RxSignalsStoreModule, because the standard-case is to use a single store-instance in all your modules and thus, all these modules should callwithRootStore()
. See the next section on use-cases forwithChildStore()
.
If you are really sure that you have a feature-module where you want to use a child-store (derived from the root-store that you get with RxSignalsStoreModule
or RxSignalsStoreModule.withRootStore()
), then you can do so by importing RxSignalsStoreModule.withChildStore()
.
Make sure to read the documentation on child-stores.
Also, be aware that store-lifecycles might be a better option for your use-case.
If you read about the concept about side-effect-isolation with the store, you know that the only side-effect that the functions passed to RxSignalsStoreModule.withRootStore()
and/or RxSignalsStoreModule.withRootStore()
are allowed to to is calling methods of the passed store.
All the signals being setup in this process should be free of side-effects (allowing you to call the setup-functions in your tests without any need of mockup).
Consequently, the side-effects must be injected to the store by corresponding calls to store.addEffect
.
The suggested way to do so, is to inject the store in services that perform the effects and call store.addEffect
there.
In your unit-tests, you would then just mock the effects themselves by store.addEffect(effectId, () => someMockupReturn)
(so no need to mock the whole service).
FAQs
Angular provider for @rx-signals/store
The npm package @rx-signals/angular-provider receives a total of 1 weekly downloads. As such, @rx-signals/angular-provider popularity was classified as not popular.
We found that @rx-signals/angular-provider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.