-
Notifications
You must be signed in to change notification settings - Fork 93
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
Pass the entire slice to selectors function #188
Conversation
Note to reviewers this was discussed/agreed in this issue: #187 @robbaman you can run the tests with |
It seems while this change does work in runtime it does in fact break a test because of a TypeScript compiler flag. This error can be suppressed by setting |
You should be able to solve this by passing in selectors?: (
state: SignalSlice<
TSignalValue,
TActionSources,
any,
TEffects,
TActionEffects
>
) => TSelectors; |
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.
With the typing change I think we will then just need a test to verify the new functionality and we should be good to merge
selectors?: ( | ||
state: SignalSlice< | ||
TSignalValue, | ||
TActionSources, | ||
TSelectors, | ||
any, | ||
TActionEffects | ||
> | ||
) => TSelectors; |
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.
selectors?: ( | |
state: SignalSlice< | |
TSignalValue, | |
TActionSources, | |
TSelectors, | |
any, | |
TActionEffects | |
> | |
) => TSelectors; | |
selectors?: ( | |
state: SignalSlice< | |
TSignalValue, | |
TActionSources, | |
any, | |
TEffects, | |
TActionEffects | |
> | |
) => TSelectors; |
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.
You're correct. I've made the change and also changed the test file to read the age
property from state().age
to state.age()
to confirm it is indeed the entire slice that is provided.
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, thanks!
Will just need to wait on a reviewer with write access to trigger the workflow and get this merged
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 5ee21f4. 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 ⌛ The following target is in progress ✅ Successfully ran 3 targetsSent with 💌 from NxCloud. |
@all-contributors please add @robbaman for code |
I've put up a pull request to add @robbaman! 🎉 |
Changed the selector definition to be the entire signalSlice as oposed to just the state.
Not sure how to run the tests (the docs just say to 'run the tests'), so not sure if this also required a change to the test framework. The changed version did do what I'd expect in my project.