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.

Could we also support promises?

See original GitHub issue

I really enjoy using this library and I feel like we could also use it for promises?

(FSA) Payload would look something like:

{
  payload: {
    promise: new Promise(...),
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
klis87commented, Sep 9, 2019

@strdr4605 i am referring to https://github.com/klis87/redux-saga-requests/blob/master/packages/redux-saga-requests/src/actions.js#L65, those checks need to be quite strict not to conflict other libraries.

For now I guess u could try this:

{
  type: `FETCH_STH`,
  request: { query: aPromise },
};

export const createDriver = () => ({
  requestInstance: null,
  getAbortSource() {
    return null;
  },
  abortRequest() {},
  sendRequest(requestConfig) {
    return requestConfig.query;
  },
  getSuccessPayload(response) {
    return response;
  },
  getErrorPayload(error) {
    return error;
  },
});
1reaction
klis87commented, Sep 1, 2019

Replaced label to enhancement, as I will add official promise driver at some point. Then it will be possible to use external APIs as well like Firebase SDK.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promises | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end ... A promise represents the eventual result of an asynchronous operation....
Read more >
Promise - JavaScript - MDN Web Docs
You will also hear the term resolved used with promises — this means that ... used to wrap functions that do not already...
Read more >
JavaScript Promises: an introduction - web.dev
Promises simplify deferred and asynchronous computations. A promise represents an operation that hasn't completed yet.
Read more >
Native Support for Promises in Node.js - Stack Overflow
But I can't seem to get promises to work (natively) in Node.js. I've tried the following code in Chrome 32 and it works....
Read more >
JavaScript Promises – The promise.then, promise.catch and ...
And when the promises complete, you can use the data in them. ... It's also possible that the then method can return another...
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