Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(store): warn on unhandled actions #1870

Merged
merged 2 commits into from
Dec 9, 2022
Merged

Conversation

arturovt
Copy link
Member

@arturovt arturovt commented Jun 22, 2022

No description provided.

@arturovt arturovt force-pushed the warn-unhandled-actions branch from 434bcd8 to d42966e Compare June 22, 2022 23:14
@bundlemon
Copy link

bundlemon bot commented Jun 22, 2022

BundleMon

Files updated (2)
Status Path Size Limits
fesm5/ngxs-store.js
143.11KB (+5.42KB +3.94%) 145KB / +0.5%
fesm2015/ngxs-store.js
122.48KB (+4.07KB +3.43%) 125KB / +0.5%
Unchanged files (4)
Status Path Size Limits
fesm5/ngxs-store-operators.js
10.01KB 15KB / +0.5%
fesm2015/ngxs-store-operators.js
9.87KB 15KB / +0.5%
fesm5/ngxs-store-internals.js
6.58KB 20KB / +0.5%
fesm2015/ngxs-store-internals.js
5.65KB 20KB / +0.5%

Total files change +9.48KB +3.29%

Groups updated (6)
Status Path Size Limits
@ngxs/store(esm5)[gzip]
./esm5/**/*.js
187.46KB (+6.46KB +3.57%) +1%
@ngxs/store(esm2015)[gzip]
./esm2015/**/*.js
180.24KB (+5.95KB +3.41%) +1%
@ngxs/store(umd)[gzip]
./bundles/*.umd.js
41.54KB (+1006B +2.42%) +1%
@ngxs/store(fesm5)[gzip]
./fesm5/*.js
30.81KB (+971B +3.18%) +1%
@ngxs/store(fesm2015)[gzip]
./fesm2015/*.js
28.07KB (+772B +2.76%) +1%
@ngxs/store(umd.min)[gzip]
./bundles/*.umd.min.js
14.03KB (+390B +2.79%) +1%

Final result: ❌

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link

bundlemon bot commented Jun 22, 2022

BundleMon (NGXS Plugins)

Unchanged files (28)
Status Path Size Limits
Plugins(umd)[gzip]
storage-plugin/bundles/ngxs-storage-plugin.um
d.js
7.98KB +1%
Plugins(umd)[gzip]
router-plugin/bundles/ngxs-router-plugin.umd.
js
7.28KB +1%
Plugins(umd)[gzip]
hmr-plugin/bundles/ngxs-hmr-plugin.umd.js
6.96KB +1%
Plugins(umd)[gzip]
websocket-plugin/bundles/ngxs-websocket-plugi
n.umd.js
6.87KB +1%
Plugins(umd)[gzip]
devtools-plugin/bundles/ngxs-devtools-plugin.
umd.js
6.53KB +1%
Plugins(umd)[gzip]
form-plugin/bundles/ngxs-form-plugin.umd.js
6.44KB +1%
Plugins(umd)[gzip]
logger-plugin/bundles/ngxs-logger-plugin.umd.
js
5.77KB +1%
Plugins(fesm5)[gzip]
storage-plugin/fesm5/ngxs-storage-plugin.js
4.67KB +1%
Plugins(fesm2015)[gzip]
storage-plugin/fesm2015/ngxs-storage-plugin.j
s
4.35KB +1%
Plugins(fesm5)[gzip]
router-plugin/fesm5/ngxs-router-plugin.js
3.91KB +1%
Plugins(fesm5)[gzip]
hmr-plugin/fesm5/ngxs-hmr-plugin.js
3.62KB +1%
Plugins(fesm2015)[gzip]
router-plugin/fesm2015/ngxs-router-plugin.js
3.56KB +1%
Plugins(fesm5)[gzip]
websocket-plugin/fesm5/ngxs-websocket-plugin.
js
3.53KB +1%
Plugins(fesm2015)[gzip]
hmr-plugin/fesm2015/ngxs-hmr-plugin.js
3.25KB +1%
Plugins(fesm5)[gzip]
devtools-plugin/fesm5/ngxs-devtools-plugin.js
3.21KB +1%
Plugins(fesm2015)[gzip]
websocket-plugin/fesm2015/ngxs-websocket-plug
in.js
3.15KB +1%
Plugins(umd.min)[gzip]
hmr-plugin/bundles/ngxs-hmr-plugin.umd.min.js
3.1KB +1%
Plugins(fesm5)[gzip]
form-plugin/fesm5/ngxs-form-plugin.js
3.07KB +1%
Plugins(fesm2015)[gzip]
devtools-plugin/fesm2015/ngxs-devtools-plugin
.js
3.03KB +1%
Plugins(fesm2015)[gzip]
form-plugin/fesm2015/ngxs-form-plugin.js
2.74KB +1%
Plugins(umd.min)[gzip]
router-plugin/bundles/ngxs-router-plugin.umd.
min.js
2.72KB +1%
Plugins(umd.min)[gzip]
storage-plugin/bundles/ngxs-storage-plugin.um
d.min.js
2.54KB +1%
Plugins(fesm5)[gzip]
logger-plugin/fesm5/ngxs-logger-plugin.js
2.48KB +1%
Plugins(umd.min)[gzip]
form-plugin/bundles/ngxs-form-plugin.umd.min.
js
2.43KB +1%
Plugins(fesm2015)[gzip]
logger-plugin/fesm2015/ngxs-logger-plugin.js
2.37KB +1%
Plugins(umd.min)[gzip]
websocket-plugin/bundles/ngxs-websocket-plugi
n.umd.min.js
2.18KB +1%
Plugins(umd.min)[gzip]
logger-plugin/bundles/ngxs-logger-plugin.umd.
min.js
1.95KB +1%
Plugins(umd.min)[gzip]
devtools-plugin/bundles/ngxs-devtools-plugin.
umd.min.js
1.86KB +1%

No change in files bundle size

Unchanged groups (6)
Status Path Size Limits
All Plugins(esm5)[gzip]
./-plugin/esm5/**/.js
128.77KB +1%
All Plugins(esm2015)[gzip]
./-plugin/esm2015/**/.js
123.36KB +1%
All Plugins(umd)[gzip]
./-plugin/bundles/.umd.js
47.84KB +1%
All Plugins(fesm5)[gzip]
./-plugin/fesm5/.js
24.49KB +1%
All Plugins(fesm2015)[gzip]
./-plugin/fesm2015/.js
22.45KB +1%
All Plugins(umd.min)[gzip]
./-plugin/bundles/.umd.min.js
16.77KB +1%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link

bundlemon bot commented Jun 22, 2022

BundleMon (Integration Projects)

Files updated (4)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng11-ivy/dist-integration/main.(h
ash).js
71.32KB (+57B +0.08%) +1%
Main bundles(Gzip)
hello-world-ng12-ivy/dist-integration/main.(h
ash).js
68.03KB (+57B +0.08%) +1%
Main bundles(Gzip)
hello-world-ng13-ivy/dist-integration/main.(h
ash).js
69.94KB (+48B +0.07%) +1%
Main bundles(Gzip)
hello-world-ng14-ivy/dist-integration/main.(h
ash).js
65.63KB (+46B +0.07%) +1%

Total files change +208B +0.07%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@arturovt arturovt force-pushed the warn-unhandled-actions branch from d42966e to 3aa3031 Compare June 23, 2022 15:47
@markwhitfeld
Copy link
Member

@arturovt Could you add a description for this PR and the motivation for the feature?

@arturovt arturovt force-pushed the warn-unhandled-actions branch from 3aa3031 to 4b44381 Compare August 1, 2022 19:04
@arturovt arturovt marked this pull request as ready for review August 1, 2022 19:04
@arturovt arturovt force-pushed the warn-unhandled-actions branch from 4b44381 to 4ff52bd Compare September 4, 2022 21:01
@arturovt arturovt added this to the v3.8.0 milestone Nov 29, 2022
Copy link
Member

@markwhitfeld markwhitfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the API for this needs to be revised.
See the last comment.

packages/store/src/public_api.ts Outdated Show resolved Hide resolved
packages/store/src/public_api.ts Outdated Show resolved Hide resolved
Comment on lines 13 to 22
TestBed.configureTestingModule({
imports: [NgxsModule.forRoot([], { warnOnUnhandledActions })]
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose a bit of a different API for this.
No config option, or ignoreActions utility, but rather a module that is provided:

Suggested change
TestBed.configureTestingModule({
imports: [NgxsModule.forRoot([], { warnOnUnhandledActions })]
});
TestBed.configureTestingModule({
imports: [
NgxsModule.forRoot([]),
ngDevMode && NgxsDevelopmentModule.forRoot({
warnOnUnhandledActions: true
/* or supply an object:
warnOnUnhandledActions: {
ignore: [ 'SomeActionType', FooActionClass ]
}
*/
})
]
});

This keeps the API consolidated and clear, and follows the existing conventions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it.

@arturovt arturovt force-pushed the warn-unhandled-actions branch from 4ff52bd to ce41941 Compare December 7, 2022 07:21
@arturovt arturovt force-pushed the warn-unhandled-actions branch from ce41941 to 15a402a Compare December 7, 2022 17:28
@codeclimate
Copy link

codeclimate bot commented Dec 9, 2022

Code Climate has analyzed commit 63de3f6 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

The test coverage on the diff in this pull request is 97.3% (50% is the threshold).

This pull request will bring the total coverage in the repository to 96.9% (0.0% change).

View more on Code Climate.

@markwhitfeld markwhitfeld merged commit 1bdb8c0 into master Dec 9, 2022
@markwhitfeld markwhitfeld deleted the warn-unhandled-actions branch December 9, 2022 06:53
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Mar 29, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@ngxs/form-plugin](https://github.com/ngxs/store) | dependencies | minor | [`3.7.6` -> `3.8.0`](https://renovatebot.com/diffs/npm/@ngxs%2fform-plugin/3.7.6/3.8.0) |
| [@ngxs/storage-plugin](https://github.com/ngxs/store) | dependencies | minor | [`3.7.6` -> `3.8.0`](https://renovatebot.com/diffs/npm/@ngxs%2fstorage-plugin/3.7.6/3.8.0) |
| [@ngxs/store](https://github.com/ngxs/store) | dependencies | minor | [`3.7.6` -> `3.8.0`](https://renovatebot.com/diffs/npm/@ngxs%2fstore/3.7.6/3.8.0) |

---

### Release Notes

<details>
<summary>ngxs/store</summary>

### [`v3.8.0`](https://github.com/ngxs/store/blob/HEAD/CHANGELOG.md#&#8203;380-2023-03-29)

[Compare Source](ngxs/store@v3.7.6...v3.8.0)

-   Feature: Build packages in Ivy format [#&#8203;1945](ngxs/store#1945)
-   Feature: Add advanced selector utilities [#&#8203;1824](ngxs/store#1824)
-   Feature: Expose `ActionContext` and `ActionStatus` [#&#8203;1766](ngxs/store#1766)
-   Feature: `ofAction*` methods should have strong types [#&#8203;1808](ngxs/store#1808)
-   Feature: Improve contextual type inference for state operators [#&#8203;1806](ngxs/store#1806) [#&#8203;1947](ngxs/store#1947)
-   Feature: Enable warning on unhandled actions [#&#8203;1870](ngxs/store#1870) [#&#8203;1951](ngxs/store#1951)
-   Feature: Router Plugin - Provide more actions and navigation timing option [#&#8203;1932](ngxs/store#1932)
-   Feature: Storage Plugin - Allow providing namespace for keys [#&#8203;1841](ngxs/store#1841)
-   Feature: Storage Plugin - Enable providing storage engine individually [#&#8203;1935](ngxs/store#1935)
-   Feature: Devtools Plugin - Add new options to the `NgxsDevtoolsOptions` interface [#&#8203;1879](ngxs/store#1879)
-   Feature: Devtools Plugin - Add trace options to `NgxsDevtoolsOptions` [#&#8203;1968](ngxs/store#1968)
-   Feature: Form Plugin - Allow `ngxsFormDebounce` to be string [#&#8203;1972](ngxs/store#1972)
-   Performance: Tree-shake patch errors [#&#8203;1955](ngxs/store#1955)
-   Fix: Get descriptor explicitly when it's considered as a class property [#&#8203;1961](ngxs/store#1961)
-   Fix: Avoid delayed updates from state stream [#&#8203;1981](ngxs/store#1981)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4yNC41IiwidXBkYXRlZEluVmVyIjoiMzUuMjQuNSJ9-->

Co-authored-by: cabr2-bot <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1837
Reviewed-by: Epsilon_02 <[email protected]>
Co-authored-by: Calciumdibromid Bot <[email protected]>
Co-committed-by: Calciumdibromid Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants