Closed arturovt closed 1 month ago
CI is running/has finished running commands for commit ddbed5600f4e8746aafdef919f1ebe379d2dbc8d. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
Sent with 💌 from NxCloud.
``` yarn add https://pkg.pr.new/@ngxs/devtools-plugin@2224.tgz ```
``` yarn add https://pkg.pr.new/@ngxs/form-plugin@2224.tgz ```
``` yarn add https://pkg.pr.new/@ngxs/hmr-plugin@2224.tgz ```
``` yarn add https://pkg.pr.new/@ngxs/router-plugin@2224.tgz ```
``` yarn add https://pkg.pr.new/@ngxs/storage-plugin@2224.tgz ```
``` yarn add https://pkg.pr.new/@ngxs/store@2224.tgz ```
``` yarn add https://pkg.pr.new/@ngxs/websocket-plugin@2224.tgz ```
commit: ddbed56
Total files change +152B +0.12%
Final result: :white_check_mark:
View report in BundleMon website ➡️
No change in files bundle size
Final result: :white_check_mark:
View report in BundleMon website ➡️
Total files change +158B +0.07%
Final result: :white_check_mark:
View report in BundleMon website ➡️
Code Climate has analyzed commit ddbed560 and detected 0 issues on this pull request.
The test coverage on the diff in this pull request is 96.4% (50% is the threshold).
This pull request will bring the total coverage in the repository to 95.3% (-0.1% change).
View more on Code Climate.
@arturovt
Sorry to bother you, just wanted to ask for a small favor.
@angular-ru/ngxs
library relies heavily on ngxs/store
internals. After your recent ngxs
refactoring, I have updated @angular-ru/ngxs
to be compatible with ngxs
v18.1.3
(https://github.com/Angular-RU/angular-ru-sdk/pull/1527) but since I'm not too familiar with ngxs
inner workings, I imagine the code might be suboptimal. When you have some time, could you take a look at the PR and specifically at the @DataAction
decorator (docs) and let me know if the code could be improved?
I would first remove NgxsDataInjector.ngZone?.run(...)
because it’s not required for NGXS. It doesn’t care whether dispatched events come from the Angular zone or not, as the state updates are decoupled from the dispatcher, and the new state always occurs within the Angular zone.
Since states are decorated with @StateRepository
, that decorator could return a new constructor function, which is always called within the Angular injection context. You can capture the injector through this[SomeInternalInjectorSymbol] = inject(Injector)
. The descriptor.value
function now has access to this[SomeInternalInjectorSymbol]
and can retrieve anything from the "app" injector as well as from the globally configured static injector. However, static properties wouldn't work properly for server-side rendered apps. If a new app is rendered for the first HTTP request and then a second request comes in, the newly bootstrapped app would overwrite static properties.
Thanks for the suggestions.
You can capture the injector through this[SomeInternalInjectorSymbol] = inject(Injector).
Basically this type of injector usage instead of global static injector could fix the mentioned SSR issue?
What do you think about the operation caching used in the @DataAction
decorator? Is it necessary and can it be simplified?
Is it ok to use hydrateActionMetasMap() in the decorator or could there be some better/simpler way to register the handlers?
I think it might be better to find a way to register actions without relying on internal APIs, which are likely to change in the future. It seems that the DataAction
decorator updates the metadata only when the method is called for the first time, but it should behave like the Action
decorator and update the metadata immediately. This would eliminate the need to call hydrateActionMetasMap
.
@arturovt thank you for your insights.
The @Action
decorator is definitely a good example of how @DataAction
could be implemented.
This adds a new internal construct, called the
ActionRegistry
. TheActionRegistry
facilitates the registration, and recall, of all handlers associated with an action type. The default handler registered for each@Action
within a state is now responsible for handling the return value of the user's handler within the state and the cancellation logic for the handler.