Skip to content

Commit

Permalink
fix: "Load more" not clickable after 1st click on 3-dot
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtextrem committed Apr 5, 2020
1 parent 3afe070 commit 885779d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/PostsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export default class PostsContainer extends Component {
handleBtnClick(event) {
event.target.disabled = true
this.loadData()

window.setTimeout(() => {
event.target.disabled = false
}, 15000) // let user retry if nothing has happened after 15 sec
}

addStorageListener() {
Expand Down Expand Up @@ -169,7 +173,6 @@ export default class PostsContainer extends Component {
)
}

// @TODO: Implement https://github.com/valdrinkoshi/virtual-list
render() {
const { hasCategories } = this.props
const { items, timeout } = this.state
Expand All @@ -179,7 +182,9 @@ export default class PostsContainer extends Component {
<div class="position-relative">
<CardDeck class="justify-content-center">{Posts(items, this.renderPost, hasCategories)}</CardDeck>
<div class="text-center">
<Button onClick={this.handleBtnClick}>Load more</Button>
<Button onClick={this.handleBtnClick} disabled={false}>
Load more
</Button>
</div>
</div>
)
Expand Down

0 comments on commit 885779d

Please sign in to comment.