As per this internal Slack conversation, the following code snippet can be refactored. The resolution map should be removed from the generic Footer component and each module should implement its own selector to determine which selector should be resolved in order to determine whether it's settings have loaded or not.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
The code that determines the loading state within each module's settings footer (assets/js/components/settings/SettingsActiveModule/Footer.js) should be refactored so that:
Each module itself should implement its own selector which determines whether the module's settings would have been loaded or not. This information should then be used directly within this <Footer> component.
Implementation Brief
[ ] In assets/js/googlesitekit/modules/datastore/settings.js, add a new selector, isSettingsLoading. Similar to isDoingSubmitChanges, it should fetch the module datastore from the slug provided and call the selector of the same name from the individual module's datastore. Similarly, if the correct module-slugh or selector doesn't exist, it should just return false.
[ ] In assets/js/modules/analytics-4/datastore/settings.js, assets/js/modules/tagmanager/datastore/settings.js and assets/js/modules/search-console/datastore/settings.js, add a new selector that checks if the appropriate selector based on the resolutionMapping in assets/js/components/settings/SettingsActiveModule/Footer.js has finished resolution.
Test Coverage
Add tests for the new selectors similar to the tests for isDoingSubmitChanges().
Feature Description
As per this internal Slack conversation, the following code snippet can be refactored. The resolution map should be removed from the generic Footer component and each module should implement its own selector to determine which selector should be resolved in order to determine whether it's settings have loaded or not.
https://github.com/google/site-kit-wp/blob/f9a0480c5612f3a6c32e2703a5070792fa7351e9/assets/js/components/settings/SettingsActiveModule/Footer.js#L147-L169
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
assets/js/components/settings/SettingsActiveModule/Footer.js
) should be refactored so that:<Footer>
component.Implementation Brief
assets/js/googlesitekit/modules/datastore/settings.js
, add a new selector,isSettingsLoading
. Similar toisDoingSubmitChanges
, it should fetch the module datastore from the slug provided and call the selector of the same name from the individual module's datastore. Similarly, if the correct module-slugh or selector doesn't exist, it should just return false.assets/js/modules/analytics-4/datastore/settings.js
,assets/js/modules/tagmanager/datastore/settings.js
andassets/js/modules/search-console/datastore/settings.js
, add a new selector that checks if the appropriate selector based on theresolutionMapping
inassets/js/components/settings/SettingsActiveModule/Footer.js
has finished resolution.Test Coverage
isDoingSubmitChanges()
.QA Brief
Changelog entry