-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
compatibility with reselect? #118
Comments
+1, I am also confused about whether I should be using |
I may also be confused about what sort of memoization is going on in createSelector vs what sort of memoization is going on in Store.select(). |
Ah, good point about that line of code. Our intention is certainly to maintain compatibility with Reselect because they offer more advanced features. I will happily accept a PR that simplifies that code path. |
@MikeRyanDev One solution is to just remove the part of store where it wraps a selector in createSelector if it is not already a selector. That puts the onus on the user to add createSelector, but it also allows the user to omit memoization if they have a selector where memoization causes a performance hit. |
In general, I'm not sure that the benefits outweigh the added technical debt for ngrx implementing its own version of reselect. reselect is a pretty small library. I know you need it if you want to add createFeatureSelector without adding a dependency on reselect, but a feature selector is such a simple selector that it seems overkill. |
+1, totally agree. Setting up |
@karptonite Sounds like a good solution to me. Also, our own memoized selector implementation is very little code. It was put in place so that we didn't need any dependencies and to put in groundwork for future improvements. It seems very likely that future ngrx libraries will be providing their own selectors. |
I'll get out a pull request. |
I see that ngrx 4 now has its own implementation of
createSelector()
. However, will it still be compatible with reselect, should we choose to use it for some of the more advanced features that reselect offers?I'm a bit concerned in particular about this bit of code here:
platform/modules/store/src/store.ts
Lines 73 to 76 in 48a2381
where it looks as if the code checks
isSelector()
(for which I think a reselect selector would return false) then wraps the selector in an ngrx selector if it is not a selector, possibly leading to the result being "double memoized".The text was updated successfully, but these errors were encountered: