-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update to 0.2 breaks #3
Comments
Thanks for the report - I'll look into it. Jump back to 0.1 in the mean time |
@esphen Yeah already reverted to 0.1 and it works fine |
I tried to reproduce this today, but no luck. 0.2 seems to work fine in my tests. See this repo. Can you please provide a minimal reproduction repo? |
maybe here:{this.props.data ? JSON.stringify(this.props.data, null, 2) : 'no error' } |
Yes the problem seems to come from stateless components. I'm only using stateless component with fetch-hoc. |
Guys, rendering in a stateless component works fine for me. import React from 'react';
import ReactDOM from 'react-dom';
import fetch from 'fetch-hoc';
import App from './App';
let FooComponent = props => {
if (props.error) {
return <div className="error">An error occured! {props.error.toString()}</div>;
}
if (props.loading) {
return <div className="loading">Loading...</div>;
}
return (
<code><pre>
{JSON.stringify(props.data, null, 2)}
</pre></code>
);
}
FooComponent = fetch('http://httpbin.org/get')(FooComponent);
ReactDOM.render(<FooComponent />, document.getElementById('root')); Can you please post a minimal reproducible case? A gist or something? |
I did some hacking, and may have an idea what your issue is. There was a change in the Here's the loading states as present:
My theory is that you're throwing on step 1 because data is not yet assigned. Is this correct? The reasoning behind changing step 1 to be loading=false is because it's has not actually started fetching yet, and if you pass a function like I realize this makes the API harder to use, so I'll look into calculating initial loading state based on what is passed to |
I released 0.3.0 with the above change, try it out |
Thanks ! That was it ! 0.3 fixed the issue for me. |
After updating to 0.2, none of my requests are fired anymore, loading prop is always false and data always undefined.
The text was updated successfully, but these errors were encountered: