-
Notifications
You must be signed in to change notification settings - Fork 405
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
refactor(router-plugin): mark selectors as pure #2248
Conversation
In this commit, we first remove the `@Selector()` decorator because we can use `createSelector` directly. This also removes `__decorate` calls for the `state` and `url` properties. Secondly, we mark these properties as 'pure.' The `/* @__PURE__ */` hint tells the bundler that `createSelector` has no side effects and that the output of this expression can be safely removed if unused. Therefore, if `state` or `url` is never accessed anywhere in our code, it can be tree-shaken.
85a72de
to
7e8a596
Compare
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 7e8a596. 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 targetsSent with 💌 from NxCloud. |
commit: |
Code Climate has analyzed commit 7e8a596 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 95.3% (0.0% change). View more on Code Climate. |
BundleMonUnchanged files (6)
No change in files bundle size Unchanged groups (2)
Final result: ✅ View report in BundleMon website ➡️ |
BundleMon (NGXS Plugins)Unchanged files (9)
Total files change -8B -0.04% Unchanged groups (1)
Final result: ✅ View report in BundleMon website ➡️ |
BundleMon (Integration Projects)Files updated (3)
Total files change -256B -0.12% Final result: ✅ View report in BundleMon website ➡️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In this commit, we first remove the
@Selector()
decorator because we can usecreateSelector
directly. This also removes__decorate
calls for thestate
andurl
properties. Secondly, we mark these properties as 'pure.' The/* @__PURE__ */
hint tells the bundler thatcreateSelector
has no side effects and that the output of this expression can be safely removed if unused. Therefore, ifstate
orurl
is never accessed anywhere in our code, it can be tree-shaken.