Last active
July 9, 2019 07:01
-
-
Save jtomaszewski/0d4b97099fed9f703b4d900086618096 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetch results when: | |
// - page is changed (immediately after): | |
// - "sort by" filter is changed (immediately after), | |
// - search query is changed (after 500 ms debounce), | |
// - filters are changed (after 300 ms debounce) | |
const refetchResultsEpic = action$ => { | |
return Observable.merge( | |
action$.ofType(CHANGE_QUERY).debounceTime(500), | |
action$.ofType(CHANGE_FILTERS).debounceTime(300), | |
action$.ofType(CHANGE_PAGE), | |
action$.ofType(CHANGE_SORT_BY), | |
) | |
.mapTo({ type: FETCH_RESULTS }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment