Skip to content

Commit 51db32c

Browse files
dognose24claude
andcommitted
Stats post detail: prefetch email availability unless subscriptions is provably inactive
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01C5G7Fg8tpLg8Qe9EaSs79t
1 parent 7268215 commit 51db32c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

client/my-sites/stats/controller.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,13 @@ export function post( context, next ) {
423423
// tab strip doesn't pop in after the page renders.
424424
const state = context.store.getState();
425425
const { supportsEmailStats } = getEnvStatsFeatureSupportChecks( state, siteId );
426+
// Module state is often not loaded yet at route time (QueryJetpackModules runs
427+
// after mount, and /me/sites does not carry active_modules), so only a definite
428+
// "inactive" skips the warm-up; the page's own `enabled` check stays strict.
426429
const canHaveEmailStats =
427430
!! supportsEmailStats &&
428-
!! (
429-
isSimpleSite( state, siteId ) || isJetpackModuleActive( state, siteId, 'subscriptions', true )
430-
);
431+
( isSimpleSite( state, siteId ) ||
432+
isJetpackModuleActive( state, siteId, 'subscriptions', true ) !== false );
431433
if ( canHaveEmailStats && postId > 0 ) {
432434
context.queryClient.prefetchQuery( postEmailStatsAvailabilityQueryOptions( siteId, postId ) );
433435
}

0 commit comments

Comments
 (0)