Skip to content

Conversation

@fabio-paiva-sp
Copy link
Contributor

@fabio-paiva-sp fabio-paiva-sp commented Oct 30, 2017

The opposite from delay, to keep the placeholder for some milliseconds even after the content is ready

See #54

@nemobot nemobot added the WIP label Oct 30, 2017
@gabro gabro requested a review from FrancescoCioria October 30, 2017 14:05
@nemobot nemobot added in review and removed WIP labels Oct 30, 2017
componentWillReceiveProps(nextProps) {
if (!this.props.firstLaunchOnly && this.state.ready && !nextProps.ready) {
this.setNotReady();
if (!this.props.firstLaunchOnly && !nextProps.ready) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this new code over complicated and difficult to read...
Why didn't you use the two functions setReady and setNotReady already implemented?
we already have a state variable called ready to decide if we should render the placeholder or the content => I don't see the need of the new this.state.holdPlaceholder variable


componentWillMount() {
if (this.props.holdPlaceholder > 0) {
this.holdPlaceholderTimeout = setTimeout(() => this.setState({ holdPlaceholder: false }), this.props.holdPlaceholder);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you always setting a timeout? shouldn't it be added only if this.state.ready (which is initialized to this.props.ready) is true?


render() {
return this.state.ready ? this.props.children : this.getFiller();
const { ready, holdPlaceholder } = this.state;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have ready, can't see the need for another variable that does the same thing

@nemobot nemobot added WIP and removed in review labels Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants