question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Negative `pending` when using `sendRequest`

See original GitHub issue

When using the low-level API with sendRequest the pending state becomes negative e.g:

// saga
function* loadSomething(): Saga {
  const {response, error} = yield call(sendRequest, actions.fetchSomething());
}
// reducer
....
    something: requestsReducer({
      actionType: FETCH_SOMETHING,
      getData: (state, action) => action.data,
    }),
...

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:39 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
burgaloncommented, Oct 16, 2018

(by saying “same action”) I mean that fetchBooks() can be called in the same app in two different scenarios:

  1. From saga function *watchBookUpdate() {yield put.resolve(fetchBooks)}}
  2. From <BookList> function componentDidMount {this.props.fetchBooks();}
1reaction
klis87commented, Mar 24, 2020

@mihaisavezi I am glad you solved it, anyway sendRequest for sure will be gone from this library, as it won’t be powered by sagas anymore, just pure redux

I recommend you doing the following:

  1. pass promisify: true to handleRequests and add requestsMiddleware to middlewares like in docs
  2. if u have an action like:
const fetchSth = () => ({
  type: 'FETCH_STH',
  request: { url: '/' },
  meta: { asPromise: true },
})
  1. you can dispatch it anywhere like store.dispatch(fetchSth()).then().catch()
  2. or you can do the same with saga, like const response = yield putResolve(fetchSth()), or with older version of saga const response = yield put.resolve(fetchSth())
  3. you can pass autoPromisify: true to handleRequests to promisify all actions, so meta.asPromise is not necessary anymore

Probably in the future version promisifying will be turned on always, so promisify, autoPromisify and meta.asPromise will be removed too

Read more comments on GitHub >

github_iconTop Results From Across the Web

BDT2866 - IBM
32C, Pending ACK count negative. Detected by module BDTSCRCX, BDTSCRCV, or BDTSNRRX. None, None. 330, Receive exit error (PUTBUF).
Read more >
Handling of TestWaitForDiagResponse Function (CANoe only)
1, a response (positive or negative) has been received (P2 or P2* ... CANoe will consider the reception of "Response Pending" responses from ......
Read more >
Cash Back Deposit Account Agreement - Spendwell
Only an Accountholder with a valid spendwell Account in good standing (meaning your Account is not presently subject to an open/pending investigation and...
Read more >
Inbound Chaining1 - Host Integration Server | Microsoft Learn
The host sends a negative response to a request in the chain. The local node sends a Status-Acknowledge(Nack-1) message to the application with...
Read more >
Frequently Asked Banking Questions & Answers - WesBanco
You can send, request, or receive money with Zelle®. To get started, log into WesBanco Bank's mobile app and select “Send Money with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found