Using an async selector in another selector, throws an Uncaught promise
See original GitHub issueHi!
I have an async selector which relies on the return value from another async selector. The values are returned fine, but I get an error in the console saying Uncaught (in promise)
.
I tried wrapping the selectors with a try..catch
, but to no avail.
Example:
const selector1 = selector({
key: "selector-1",
get: async () => {
const response = await.someAsyncAPICall();
return response;
},
});
const selector2 = selector({
key: "selector-2",
get: async ({ get }) => {
const selector1Response = get(selector1);
const response = await.someAsyncAPICallWithParams(selector1Response);
return response;
},
});
const selector3 = selector({
key: "selector-3",
get: async ({ get }) => {
const selector2Response = get(selector2);
const response = await.someAsyncAPICallWithParams(selector2Response);
return response;
},
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:7 (3 by maintainers)
Top Results From Across the Web
uncaught in promise nested async function promise error ...
I need to use fetch to post some data to server and then do other processes using javascript. but I'm confused on how...
Read more >How to avoid uncaught async errors in Javascript
The reason behind this is that only the await throws an exception that the try..catch can handle, and the first await is for...
Read more >Page - Playwright 中文文档
The method finds an element matching the specified selector within the page and passes it as a first argument to pageFunction . If...
Read more >Simplifying your application state management with Recoil
Selector. “Selectors represent a function, or derived state in Recoil”, as it states in the official documentation.
Read more >Using Cypress - Cypress Documentation
Is there a suggested way or best practice for how I should target elements or write element selectors? Can I prevent Cypress from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@justintoman well, I do need them if I’m doing some other API calls in those selectors as well. here’s an updated sandbox: https://codesandbox.io/s/twilight-sky-ru24z?file=/src/selectors.js
Resolved with 0.2.0