Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for gathering data state in Search Console and Analytics before showing User Input notification. #7198

Merged
merged 25 commits into from
Jul 11, 2023
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dd207d9
Check for gathering data state in Search Console and Analytics before…
tofumatt Jun 23, 2023
cb98195
Merge branch 'develop' into fix/6607.
10upsimon Jun 29, 2023
cae57ed
Merge branch 'develop' of github.com:google/site-kit-wp into develop.
10upsimon Jul 5, 2023
c18a364
Merge branch 'develop' of github.com:google/site-kit-wp into develop.
10upsimon Jul 6, 2023
d5da3b7
Merge branch develop into fix/6607.
10upsimon Jul 6, 2023
4b4b670
Return null from KeyMetricsSetupCTAWidget when gathering data.
techanvil Jul 6, 2023
3147fd6
Reorder conditions for consistency.
techanvil Jul 6, 2023
90b011e
Fix E2E test, providing mock data to avoid "gathering data" state.
techanvil Jul 6, 2023
b04538f
Add an explanatory comment.
techanvil Jul 6, 2023
b6687c8
Tidy up.
techanvil Jul 6, 2023
023f282
Update paths for consistency.
techanvil Jul 7, 2023
0d7a974
Fix KeyMetricsSetupCTAWidget stories.
techanvil Jul 7, 2023
642b6f7
Prevent warnings in Storybook due to unhandled POST to data-available…
techanvil Jul 7, 2023
75fa2df
Update regexes for consistency.
techanvil Jul 7, 2023
6b1d719
Fix tests for KeyMetricsSetupCTAWidget.
techanvil Jul 7, 2023
43321a6
Update tests to use getWidgetComponentProps.
techanvil Jul 10, 2023
334d63b
Merge branch 'develop' into fix/6607.
techanvil Jul 10, 2023
efa0d9f
Add tests for when SC/GA4 are gathering data.
techanvil Jul 10, 2023
59cbdeb
Add provideGatheringDataState utility function.
techanvil Jul 10, 2023
13200cb
Refactor tests and story to use provideGatheringDataState helper.
techanvil Jul 10, 2023
3c52eea
Add JSDoc for new utility helpers.
techanvil Jul 10, 2023
405e91e
Remove unneeded calls to set reference date.
techanvil Jul 10, 2023
6658567
Rename variable.
techanvil Jul 10, 2023
0442858
Remove unnecessary setting of global data.
techanvil Jul 10, 2023
4bc8ad5
Rename variable.
techanvil Jul 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 35 additions & 19 deletions assets/js/components/notifications/UserInputSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ import { getTimeInSeconds } from '../../util';
import { CORE_USER } from '../../googlesitekit/datastore/user/constants';
import { CORE_SITE } from '../../googlesitekit/datastore/site/constants';
import { CORE_MODULES } from '../../googlesitekit/modules/datastore/constants';
import { MODULES_ANALYTICS } from '../../modules/analytics/datastore/constants';
import { MODULES_ANALYTICS_4 } from '../../modules/analytics-4/datastore/constants';
import { MODULES_SEARCH_CONSOLE } from '../../modules/search-console/datastore/constants';
import Link from '../Link';
const { useSelect } = Data;

Expand All @@ -53,23 +56,32 @@ export default function UserInputSettings( {
const isUserInputCompleted = useSelect( ( select ) =>
select( CORE_USER ).isUserInputCompleted()
);
const analyticsModuleConnected = useSelect( ( select ) =>
select( CORE_MODULES ).isModuleConnected( 'analytics' )
);

const searchConsoleModuleConnected = useSelect( ( select ) =>
select( CORE_MODULES ).isModuleConnected( 'search-console' )
);
const searchConsoleIsGatheringData = useSelect(
( select ) =>
searchConsoleModuleConnected &&
select( MODULES_SEARCH_CONSOLE ).isGatheringData()
);

const analyticsModuleConnected = useSelect(
( select ) =>
select( CORE_MODULES ).isModuleConnected( 'analytics-4' ) ||
select( CORE_MODULES ).isModuleConnected( 'analytics' )
);
const analyticsIsGatheringData = useSelect( ( select ) => {
if ( select( CORE_MODULES ).isModuleConnected( 'analytics-4' ) ) {
return select( MODULES_ANALYTICS_4 ).isGatheringData();
}

if ( select( CORE_MODULES ).isModuleConnected( 'analytics' ) ) {
return select( MODULES_ANALYTICS ).isGatheringData();
}

// TODO: Re-implement the Gathering Data check once Issue #5933 is merged
// and this data is available on page load.
// const searchConsoleIsGatheringData = useSelect( ( select ) =>
// select( MODULES_SEARCH_CONSOLE ).isGatheringData()
// );
// const analyticsIsGatheringData = useSelect(
// ( select ) =>
// analyticsModuleConnected &&
// select( MODULES_ANALYTICS ).isGatheringData()
// );
return false;
} );

if ( isUserInputCompleted === undefined || isUserInputCompleted ) {
return null;
Expand All @@ -79,12 +91,16 @@ export default function UserInputSettings( {
return null;
}

// if (
// analyticsIsGatheringData !== false ||
// searchConsoleIsGatheringData !== false
// ) {
// return null;
// }
// Don't show the component if either module is gathering data, or
// if the gathering data state is still loading/resolving.
if (
analyticsIsGatheringData === undefined ||
analyticsIsGatheringData === true ||
searchConsoleIsGatheringData === undefined ||
searchConsoleIsGatheringData === true
) {
return null;
}

return (
<BannerNotification
Expand Down