-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐦 👊 promise #65
🐦 👊 promise #65
Conversation
@@ -159,7 +159,8 @@ export default class Resolver extends React.Component { | |||
const factory = resolve[name]; | |||
const value = factory(props); | |||
|
|||
if (value instanceof Promise) { | |||
// duckpunched promise | |||
if (value instanceof Promise || typeof value.then === 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you switch to double-quotes to match to match the rest of the coding style? (I guess I forgot to .eslintrc
this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint was eating it for me. ran eslint src
(instead of npm run lint
) to get the error. All updated now.
@iamdustan What library are you using for fetching? I want to test out a few to ensure this works with |
Related to #64. |
I am using https://github.com/matthew-andrews/isomorphic-fetch which requires an external Promise implementation. I likely am experiencing some issues between |
I was talking to people about this today & they recommended wrapping pretty much everything in Have you heard about this? As in, |
Hah! I got bit by this bug that's actually an issue with the compiled code, I'd wager! If I
Plus, |
This needed a bit more finagling, but this works: if (value && typeof value.then === "function") {
nextState.pending[name] = value;
} else { I'd like to combine the two together for clarity. I should have this resolved tomorrow. |
@iamdustan Thanks for this. This was huge, especially considering there are major issues with |
🙌 woohoo! |
Handles my current environment that resulted in #64. There is probably a better test for this than what I have done though...