-
-
Notifications
You must be signed in to change notification settings - Fork 74
refactor: Replace caching logic with defaultMemoize for selector factories
#4280
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
base: develop
Are you sure you want to change the base?
Conversation
fa3dba9 to
8b82879
Compare
griest024
left a comment
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.
looks mostly good, explicit typing reduces readability somewhat
| export const getDaffCartFeatureSelector: < | ||
| T extends DaffCart = DaffCart, | ||
| V extends DaffCartOrderResult = DaffCartOrderResult, | ||
| >() => DaffCartFeatureMemoizedSelectors<T, V> = defaultMemoize(< |
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.
Is it necessary to explicitly type getDaffCartFeatureSelector here? Does memoized not have the correct type?
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.
There were errors with the implicit type not being recognized when importing the selector to another function, which is why I added explicit types to all the imports.
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.
ah yes,
function defaultMemoize(projectionFn: AnyFn, ...)ngrx does not type defaultMemoize strongly enough
griest024
left a comment
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.
code lgtm but needs signed commits
Signed-off-by: Joanna Lau <[email protected]>
8b82879 to
68b976f
Compare
PR Checklist
PR Type
Current behavior
Fixes: #2109
New behavior
Selector factories now use
defaultMemoizefor cachingBreaking change?
Additional context