Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable periodic updates for react-moment components #1127

Merged
merged 1 commit into from
Apr 12, 2021

Conversation

zwliew
Copy link
Contributor

@zwliew zwliew commented Apr 12, 2021

Problem

During tests, there are instances when periodic updates causes errors
due to calling setState when the component is unmounted.

Reason:
By default, the Moment component sets a timer on a 60s interval to
update the time shown.

Solution

Our time displays are all static so we don't need this feature. Hence, disable it.
This should also slightly improve efficiency since app will do less work.

Before & After Screenshots

There are no visual changes.

Tests

These tests have been verified on a local dev machine.

Assert that there are no visual changes:

  1. Deploy the frontend on Amplify.
  2. The time display on the Dashboard and on the ProgressDetails pages should appear the same as before.

Assert that the Dashboard integration tests run without console errors:

  1. Run the Dashboard integration tests in feat: add tests for happy paths in critical workflows #1110
  2. The tests should all pass and no console errors should be printed.

Deploy Notes

There are no deploy notes.

By default, the Moment component sets a timer on a 60s interval to
update the time shown. We don't need this feature since all our
components simply display a static time.

Furthermore, there are instances when periodic updates causes errors
due to calling `setState` when the component is unmounted.

Since we don't need this functionality, disable it. This should also
slightly improve efficiency since app will do less work.

Ref: https://github.com/headzoo/react-moment#interval
@zwliew zwliew changed the title fix(moment): disable periodic updates for react-moment components fix: disable periodic updates for react-moment components Apr 12, 2021
Copy link
Contributor

@lamkeewei lamkeewei left a comment

Choose a reason for hiding this comment

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

lgtm!

@lamkeewei lamkeewei merged commit a779181 into develop Apr 12, 2021
@lamkeewei lamkeewei deleted the disable-moment-interval branch April 12, 2021 16:14
lamkeewei added a commit that referenced this pull request Apr 19, 2021
* develop:
  fix(docker/awscli): upgrade to python3 and install python3-dev (#1140)
  feat(frontend): set up test fixtures and deployment processes (#1086)
  feat: allow activation of SNS as fallback for all SMS campaigns (#1019)
  1.22.4
  fix: re-fetch campaign details after campaign is sent (#1116)
  chore: upgrade dependencies (#1120)
  chore: fix build warnings (#1103)
  fix(moment): disable periodic updates for react-moment components (#1127)
  fix: avoid calling setState when components are unmounted (#1109)
  chore: add callback server (#1112)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants