311-data icon indicating copy to clipboard operation
311-data copied to clipboard

Refactor code to have a single state variable keep track of application status

Open edwinjue opened this issue 9 months ago • 3 comments

Overview

Currently, our app makes use of several different redux state variables to keep track of different application states such as isDbLoading, isMapLoading and an error object (see: /redux/reducers/data.js#L137).

To prevent impossible states, mitigate the misuse of and the need to maintain disparate state variables throughout our codebase, it may be prudent to combine these multiple state variables into a single state variable called status with each value represented by an ENUM value describing the application's current state.

This would allow our components to operate on a single source of truth and avoid potential bugs

We would like a volunteer take a look at refactoring our code to make this change and apply it throughout the codebase

The Concept

image image image

Action Items

  • [x] See where in our code we are making use of isMapLoading, isDbLoading and error object defined in /redux/reducers/data.js#L137
  • [ ] See whether it is possible to combine these states into a single state variable called status and create a new status as an ENUM that corresponds to the given application state (refer to The Concept above)
  • [ ] Add/remove any statuses as needed
  • [ ] Update all instance throughout the codebase to make use of this new single state variable

Resources/Instructions

/redux/reducers/data.js#L137

edwinjue avatar Sep 20 '23 22:09 edwinjue