Skip to content

Connect modules briefly shows another module connected. #2796

@ivankruchkoff

Description

@ivankruchkoff

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

  1. Go to /wp-admin/admin.php?page=googlesitekit-dashboard&notification=authentication_success
  2. Search Console = "Connected", AdSense, Analytics and PageSpeed Insights = "Connect Service"
  3. Click on any Connect Service
  4. Prior to redirect for auth, PageSpeed Insights shows as Connected.

Screenshots

Screen Shot 2021-02-11 at 12 47 45 PM

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 getModules when toggling module activation
    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 TODO comment 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
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Low priorityType: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions