MCPcopy
hub / github.com/reduxjs/redux / shouldFetchPosts

Function shouldFetchPosts

examples/async/src/actions/index.js:35–44  ·  view source on GitHub ↗
(state, subreddit)

Source from the content-addressed store, hash-verified

33}
34
35const shouldFetchPosts = (state, subreddit) => {
36 const posts = state.postsBySubreddit[subreddit]
37 if (!posts) {
38 return true
39 }
40 if (posts.isFetching) {
41 return false
42 }
43 return posts.didInvalidate
44}
45
46export const fetchPostsIfNeeded = subreddit => (dispatch, getState) => {
47 if (shouldFetchPosts(getState(), subreddit)) {

Callers 1

fetchPostsIfNeededFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected