Skip to content
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

Reader: Update the post time more frequently #422

Merged
merged 1 commit into from
Dec 2, 2015

Conversation

blowery
Copy link
Contributor

@blowery blowery commented Nov 22, 2015

Prior, we updated the time every 60s, which doesn't work well for posts that are very recent. This drops the update time to 10s.

In addition, we moved to only setting the state if it has changed, to avoid unnecessary rerenders.

Prior, we updated the time every 60s, which doesn't work well for posts that are very recent. This drops the update time to 10s.

In addition, we moved to only setting the state if it has changed, to avoid unnecessary rerenders.
@blowery blowery added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Feature] Reader The reader site on Calypso. labels Nov 22, 2015
@blowery blowery self-assigned this Nov 22, 2015
_update: function( date ) {
date = date || this.props.date;
this.setState( { ago: humanDate( date ) } );
this.smartSetState( { ago: humanDate( date ) } );
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to avoid setting the state if we have PureRenderMixin? It works on state, too.

Copy link
Member

Choose a reason for hiding this comment

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

Apart from that looks/works great, you can :shipit:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so, PRM doesn't prevent the all the work that happens just to get to shouldComponentUpdate. setting state enqueues work for the component, whether the new state is different or not. This avoids that work when we don't need to do it.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@nb nb added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 22, 2015
blowery added a commit that referenced this pull request Dec 2, 2015
…uently

Reader: Update the post time more frequently
@blowery blowery merged commit 221cda9 into master Dec 2, 2015
@blowery blowery deleted the fix/update-time-ago-more-frequently branch December 2, 2015 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Reader The reader site on Calypso.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants