Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Speed up processing of TimelinePanel updates on new events #277

Merged
merged 1 commit into from
Apr 19, 2016

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Apr 19, 2016

Avoid twiddling state flags, so that we can avoid redundant re-renders.

Avoid twiddling state flags, so that we can avoid redundant re-renders.
// we won't load this event now, because we don't want to push any
// events off the other end of the timeline. But we need to note
// that we can now paginate.
this.setState({canForwardPaginate: true});
Copy link
Member

Choose a reason for hiding this comment

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

Does the act of changing this ever require a re-render? If not, would it be more appropriate to just make it a regular property on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The logic behind putting it in state was mostly for consistency with canBackPaginate. But yes, we could do that. Or we could ignore changes to canForwardPaginate in shouldComponentUpdate.

Copy link
Member

Choose a reason for hiding this comment

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

OK - hopefully doing either of those would reduce the number of re-renders further? Personally I'd make them regular properties and keep state for things that affect what's drawn to the screen.

Copy link
Member Author

Choose a reason for hiding this comment

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

I need to return to this to fix element-hq/element-web#1427 anyway, so I'll go with it as-is for now.

@dbkr
Copy link
Member

dbkr commented Apr 19, 2016

Comment aside, this fix is still valid either way so lgtm.

@dbkr dbkr assigned richvdh and unassigned dbkr Apr 19, 2016
@richvdh richvdh merged commit 8bb13db into develop Apr 19, 2016
@richvdh richvdh deleted the rav/optimise_timeline_update branch April 19, 2016 18:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants