From ad830ab7c17e7dc99411543e3afea03f48259270 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Tue, 12 Feb 2019 11:47:19 +0000 Subject: [PATCH] GH-877: Updates from review-tidy up only --- .../static_src/src/app/src/components/Listing/index.js | 7 ++++--- opentech/static_src/src/app/src/containers/NoteListing.js | 2 +- .../static_src/src/app/src/redux/reducers/submissions.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/opentech/static_src/src/app/src/components/Listing/index.js b/opentech/static_src/src/app/src/components/Listing/index.js index 76a7ce103..5e247b5b9 100644 --- a/opentech/static_src/src/app/src/components/Listing/index.js +++ b/opentech/static_src/src/app/src/components/Listing/index.js @@ -62,7 +62,8 @@ export default class Listing extends React.Component { ); } - retryButton = (handleRetry) => { + renderRetryButton = () => { + const { handleRetry } = this.props; return <a className="listing__help-link" onClick={handleRetry}>Refresh</a>; } @@ -73,7 +74,7 @@ export default class Listing extends React.Component { <h5>Something went wrong!</h5> <p>{ error }</p> { !navigator.onLine && <p>You appear to be offline.</p>} - { handleRetry && this.retryButton(handleRetry) } + { handleRetry && this.renderRetryButton() } </li> ) } @@ -96,7 +97,7 @@ export default class Listing extends React.Component { </div> <p className="listing__help-text listing__help-text--standout">Something went wrong!</p> <p className="listing__help-text">Sorry we couldn't load the notes</p> - { this.handleRetry(handleRetry) } + { this.renderRetryButton() } </> } </div> diff --git a/opentech/static_src/src/app/src/containers/NoteListing.js b/opentech/static_src/src/app/src/containers/NoteListing.js index 587bc3d0e..0e4e12801 100644 --- a/opentech/static_src/src/app/src/containers/NoteListing.js +++ b/opentech/static_src/src/app/src/containers/NoteListing.js @@ -46,7 +46,7 @@ class NoteListing extends React.Component { } componentWillUnmount() { - this.pollNotes = null; + clearInterval(this.pollNotes) } handleRetry = () => { diff --git a/opentech/static_src/src/app/src/redux/reducers/submissions.js b/opentech/static_src/src/app/src/redux/reducers/submissions.js index d8772288f..df94c9584 100644 --- a/opentech/static_src/src/app/src/redux/reducers/submissions.js +++ b/opentech/static_src/src/app/src/redux/reducers/submissions.js @@ -15,7 +15,7 @@ import { import { UPDATE_NOTES, UPDATE_NOTE } from '@actions/notes' -function submission(state={id: null, comments: []}, action) { +function submission(state={comments: []}, action) { switch(action.type) { case START_LOADING_SUBMISSION: return { -- GitLab