-
Notifications
You must be signed in to change notification settings - Fork 6
✨ delay parameter #87
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
Conversation
src/core.jsx
Outdated
| componentDidMount() { | ||
| // set delay | ||
| if (delay) { | ||
| setTimeout(() => this.setState(state => ({ ...state, pastDelay: true })), delay) |
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.
you should register the timer and clear it in componentWillUnmount
this.timer = setTimeout()...
src/core.jsx
Outdated
|
|
||
| state = { | ||
| props: {}, | ||
| pastDelay: false, |
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.
- use
printfield instead ofpastDelay - init it to
true - in the
rendermethod you can simplify the condition :if (!this.state.print) return null
fabienjuif
left a comment
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.
Some comments
|
@fabienjuif it's done you can check it |
|
I should add some documentation in the readme file |
|
The code is fine, I'm waiting for the documentation :) |
|
You should probably reference the issue as well =) |
README.md
Outdated
|
|
||
| When a component loads very quickly, you will see a flash of the loading component. | ||
| To avoid this behaviour, you can add a `delay` parameter to the loader with a time in milliseconds. | ||
| Then, the loading indicator will be rendered, only after this delay (of course, if the component is loaded before, then it will be rendered) |
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.
To much ponctuation for me.
Something like that maybe ?
Then, the loading indicator will be rendered after the delay if the Component can't be rendered before that.
README.md
Outdated
| export default loader({ print: ['data'], delay: 200 })(MyComponent) | ||
| ``` | ||
|
|
||
| By default, the no delay is defined. |
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.
By default, no delay is defined. ?
|
from @ptitFicus comment, I added the reference to the issue |
fabienjuif
left a comment
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.
👌
fixes #67
TODO: