-
Notifications
You must be signed in to change notification settings - Fork 330
Closed
Labels
Milestone
Description
Bug Description
When I click connect service, it always shows the right mode service as connected before redirecting to Google for auth.
Steps to reproduce
- Go to /wp-admin/admin.php?page=googlesitekit-dashboard¬ification=authentication_success
- Search Console = "Connected", AdSense, Analytics and PageSpeed Insights = "Connect Service"
- Click on any Connect Service
- Prior to redirect for auth, PageSpeed Insights shows as Connected.
Screenshots
Added a video repro, intentionally not showing the Google Auth part:
connected-bug.mp4
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When activating a module from the "Congrats" notification (which shows up after connecting Site Kit or a module), every module should remain in its current UI state all the way until the user is redirected to OAuth (i.e. it should not visually change to looking as connected before then).
Implementation Brief
- Comment out the automatic fetching of
getModuleswhen toggling module activationsite-kit-wp/assets/js/googlesitekit/modules/datastore/modules.js
Lines 219 to 222 in 47b723d
const { response, error } = yield fetchSetModuleActivationStore.actions.fetchSetModuleActivation( slug, active ); if ( response?.success === true ) { // Fetch (or re-fetch) all modules, with their updated status. yield fetchGetModulesStore.actions.fetchGetModules(); - This will leave the module in the same state within the App until the page is refreshed, which is often needed anyways for the change to take effect to being setup, etc
- Add a
TODOcomment to clarify that this should be restored later when Site Kit no longer relies on page reloads between module activation changes
- Remove localized workarounds added to fix this in module settings
site-kit-wp/assets/js/components/settings/SettingsActiveModules.js
Lines 34 to 36 in 47b723d
// We store `initialActiveSlugs` separately to avoid // layout shifts when deactivating a module as it would otherwise // cause the module to be removed upon deactivation. site-kit-wp/assets/js/components/settings/SettingsInactiveModules.js
Lines 38 to 40 in 47b723d
// We store `initialInactiveSlugs` separately to avoid // layout shifts when activating a module as it would otherwise // cause the activated module to be removed upon activation.
- Finish and merge Receive module state on page load only #4141
- Mostly just updates to tests left
Test Coverage
- Update tests for module activation to not refetch all modules (and thus update state)
- Add tests if not covered by the last point to ensure activating or deactivating a module does not immediately change its active/connected state
QA Brief
- Activate or deactivate a module in the settings and make sure that the list of modules doesn't change until the page is refreshed or after navigating back to the settings page.
- Activate a module from the congrats notification banner and verify that modules do not change their statuses until the page is refreshed.
Changelog entry
- Fix a bug that could cause the wrong module to show that it's being connected during module setup.
