mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
fix lifecycle
This commit is contained in:
parent
d47df34ed1
commit
26c261f3e7
@ -21,7 +21,7 @@ const NoResultComponent = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Scroll behavior should scroll to next post or the previous one depending on the direction of the scroll
|
// FIXME: Scroll behavior should scroll to next post or the previous one depending on the direction of the scroll
|
||||||
export default class PostsFeed extends React.PureComponent {
|
export default class PostsFeed extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
initialLoading: true,
|
initialLoading: true,
|
||||||
fetchingData: true,
|
fetchingData: true,
|
||||||
@ -80,6 +80,11 @@ export default class PostsFeed extends React.PureComponent {
|
|||||||
window.app.shortcuts.remove("postsFeed.scrollDown")
|
window.app.shortcuts.remove("postsFeed.scrollDown")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// avoid to re-render the whole list when props change
|
||||||
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
|
return this.state !== nextState
|
||||||
|
}
|
||||||
|
|
||||||
scrollUp = () => {
|
scrollUp = () => {
|
||||||
this.scrollToIndex(this.state.currentIndex - 1)
|
this.scrollToIndex(this.state.currentIndex - 1)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user