Skip to content

Commit

Permalink
fix image thrashing (#20181)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnojima authored and buoyad committed Oct 7, 2019
1 parent e49afe6 commit 8d42c84
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions shared/chat/conversation/list-area/normal/index.desktop.tsx
Expand Up @@ -680,24 +680,24 @@ class OrdinalWaypoint extends React.Component<OrdinalWaypointProps, OrdinalWaypo
if (renderMessages) {
if (this.props.ordinals === this.lastVisibleChildrenOrdinals && this.lastVisibleChildren) {
// cache children to skip re-rendering
return this.lastVisibleChildren
content = this.lastVisibleChildren
} else {
const messages = this.props.ordinals.map((o, idx) => {
const previous = idx ? this.props.ordinals[idx - 1] : this.props.previous
return this.props.rowRenderer(o, previous, this.measure)
})
content = (
<Measure bounds={true} onResize={this.onResize}>
{({measureRef}) => (
<div data-key={this.props.id} ref={measureRef}>
{messages}
</div>
)}
</Measure>
)
this.lastVisibleChildrenOrdinals = this.props.ordinals
this.lastVisibleChildren = content
}

const messages = this.props.ordinals.map((o, idx) => {
const previous = idx ? this.props.ordinals[idx - 1] : this.props.previous
return this.props.rowRenderer(o, previous, this.measure)
})
content = (
<Measure bounds={true} onResize={this.onResize}>
{({measureRef}) => (
<div data-key={this.props.id} ref={measureRef}>
{messages}
</div>
)}
</Measure>
)
this.lastVisibleChildrenOrdinals = this.props.ordinals
this.lastVisibleChildren = content
} else {
content = <div data-key={this.props.id} style={{height: this.state.height}} />
}
Expand Down

0 comments on commit 8d42c84

Please sign in to comment.