Description
Background Info
We want to clearly indicate the files responsible for selecting, fetching and modifying data in the background. If we create a background folder, separate from the store, ducks and selectors folder, we can store our methods for calling into the background as well as our data selectors, the action-queue file as well as other background communication specific files.
This folder should have a sub folder per controller, cased in UpperCamelCase like the Controller’s base name. This way searching for the controller name will yield results for that folder. Inside each Controller folder we will have a api.ts and selectors.ts file.
At the root of the background folder we will have the action-queue file, we can move that file as part of this work (it’ll require updating minimal imports).
Where importing a background method in the Extension currently looks like this:
Import { getNetworkIdentifier } from ‘../../selectors/selectors’;
Import { setPreference } from ‘../../store/actions’;
Would become something like:
Import { getNetworkIdentifier } from ‘../../background/NetworkController/selectors’;
Import { setPreference } from ‘../../background/PreferencesController/api’;
This will allow us to do a search for ‘/PreferencesController/api’ in the UI and see everywhere that PreferencesController state might be modified by the UI and ‘/NetworkController/selectors’ to see everywhere we are relying upon the NetworkController state to render the UI.