ReactNative fetch doesn't complete until I click on the IOS simulator

94 views Asked by At

I have a RN component that fires fetchPosts in componentDidMount. The fetch posts fires immediately, but doesn't complete until I click on the IOS simulator. If I don't click on the simulator, I'll never see the receivePosts action no matter how long I wait.

Posts actions

const fetchPosts = (endpoint) => async (dispatch, getState) => {
  dispatch({type: types.FETCH_POSTS, endpoint,})
  const token = getState().user.token
  const client = new RedditClient(token)
  const response = await client.fetchAll()
  const posts = response.data.children
  dispatch(receivePosts(posts))
}

const receivePosts = (posts) => ({
  type: types.RECEIVE_POSTS,
  posts,
})
0

There are 0 answers