File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
projects/example-app/src/app/books/reducers Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import * as fromSearch from '@example-app/books/reducers/search.reducer';
7
7
import * as fromBooks from '@example-app/books/reducers/books.reducer' ;
8
8
import * as fromCollection from '@example-app/books/reducers/collection.reducer' ;
9
9
import * as fromRoot from '@example-app/reducers' ;
10
+ import { Book } from '../models/book' ;
10
11
11
12
export interface BooksState {
12
13
search : fromSearch . State ;
@@ -122,7 +123,9 @@ export const getSearchResults = createSelector(
122
123
getBookEntities ,
123
124
getSearchBookIds ,
124
125
( books , searchIds ) => {
125
- return searchIds . map ( id => books [ id ] ) ;
126
+ return searchIds
127
+ . map ( id => books [ id ] )
128
+ . filter ( ( book ) : book is Book => book != null ) ;
126
129
}
127
130
) ;
128
131
@@ -148,7 +151,9 @@ export const getBookCollection = createSelector(
148
151
getBookEntities ,
149
152
getCollectionBookIds ,
150
153
( entities , ids ) => {
151
- return ids . map ( id => entities [ id ] ) ;
154
+ return ids
155
+ . map ( id => entities [ id ] )
156
+ . filter ( ( book ) : book is Book => book != null ) ;
152
157
}
153
158
) ;
154
159
You can’t perform that action at this time.
0 commit comments