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

fix: allow selector utils usage within state class #2210

Merged
merged 3 commits into from
Aug 22, 2024

Conversation

markwhitfeld
Copy link
Member

@markwhitfeld markwhitfeld commented Aug 21, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

The createPropertySelectors utility checks that the provided selector is a valid selector.
This is great, but if the utility is used within a state class it fails this check (during ngDevMode) because the @State decorator has not yet added the selector metadata.
A similar issue exists if a @Selector decorated selector is used within the same state class.

Issue Number: #2209

What is the new behavior?

These usages are allowed. This was achieved by delaying the "valid selector" check in the dev mode.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Copy link

nx-cloud bot commented Aug 21, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 81793e5. 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


✅ Successfully ran 4 targets

Sent with 💌 from NxCloud.

Copy link

bundlemon bot commented Aug 21, 2024

BundleMon

Files updated (2)
Status Path Size Limits
fesm2022/ngxs-store.mjs
98.8KB (+1KB +1.02%) 100KB / +0.5%
fesm2022/ngxs-store-internals-testing.mjs
6.81KB (+360B +5.44%) 7KB / +0.5%
Unchanged files (4)
Status Path Size Limits
fesm2022/ngxs-store-internals.mjs
11.36KB 13KB / +0.5%
fesm2022/ngxs-store-operators.mjs
6.22KB 7KB / +0.5%
fesm2022/ngxs-store-plugins.mjs
2.04KB 3KB / +0.5%
fesm2022/ngxs-store-experimental.mjs
1.4KB 2KB / +0.5%

Total files change +1.35KB +1.08%

Groups updated (2)
Status Path Size Limits
@ngxs/store(esm2022)[gzip]
./esm2022/**/*.mjs
218.89KB (+1.74KB +0.8%) +1%
@ngxs/store(fesm2022)[gzip]
./fesm2022/*.mjs
30.22KB (+410B +1.34%) +1%

Final result: ❌

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link

bundlemon bot commented Aug 21, 2024

BundleMon (NGXS Plugins)

Unchanged files (9)
Status Path Size Limits
Plugins(fesm2022)[gzip]
storage-plugin/fesm2022/ngxs-storage-plugin.m
js
4.15KB +0.5%
Plugins(fesm2022)[gzip]
router-plugin/fesm2022/ngxs-router-plugin.mjs
3.2KB +0.5%
Plugins(fesm2022)[gzip]
websocket-plugin/fesm2022/ngxs-websocket-plug
in.mjs
2.64KB +0.5%
Plugins(fesm2022)[gzip]
hmr-plugin/fesm2022/ngxs-hmr-plugin.mjs
2.61KB +0.5%
Plugins(fesm2022)[gzip]
form-plugin/fesm2022/ngxs-form-plugin.mjs
2.59KB +0.5%
Plugins(fesm2022)[gzip]
devtools-plugin/fesm2022/ngxs-devtools-plugin
.mjs
2.23KB +0.5%
Plugins(fesm2022)[gzip]
logger-plugin/fesm2022/ngxs-logger-plugin.mjs
2.09KB +0.5%
Plugins(fesm2022)[gzip]
storage-plugin/fesm2022/ngxs-storage-plugin-i
nternals.mjs
875B +0.5%
Plugins(fesm2022)[gzip]
router-plugin/fesm2022/ngxs-router-plugin-int
ernals.mjs
411B +0.5%

No change in files bundle size

Unchanged groups (1)
Status Path Size Limits
All Plugins(fesm2022)[gzip]
./-plugin/fesm2022/.mjs
20.76KB +0.5%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link

bundlemon bot commented Aug 21, 2024

BundleMon (Integration Projects)

Files updated (1)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng16/dist-integration/main.(hash)
.js
67.58KB (+11B +0.02%) +1%
Unchanged files (2)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng18/dist-integration/browser/mai
n-(hash).js
71.66KB +1%
Main bundles(Gzip)
hello-world-ng17/dist-integration/main.(hash)
.js
68.56KB +1%

Total files change +17B +0.01%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link
Member

@arturovt arturovt left a comment

Choose a reason for hiding this comment

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

LGTM, just see my comment

Copy link

codeclimate bot commented Aug 21, 2024

Code Climate has analyzed commit 81793e5 and detected 0 issues on this pull request.

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

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

View more on Code Climate.

@markwhitfeld markwhitfeld merged commit 77cf50d into master Aug 22, 2024
15 checks passed
@markwhitfeld markwhitfeld deleted the fix/allow-selector-utils-within-state-class branch August 22, 2024 15:28
@markwhitfeld markwhitfeld added this to the v18.1.2 milestone Oct 14, 2024
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.

🐞[BUG]: Dev mode check for createPropertySelectors prevents valid usage within state class
2 participants