Wp-calypso: Stats: quries plugins for all sites on page load

Created on 22 Nov 2017  路  3Comments  路  Source: Automattic/wp-calypso

This make the page load really slow if the user has many plugins and many Jetpack sites.

Steps to reproduce

  1. Starting at URL:
  2. Go to https://wordpress.com/stats/activity/example.com

What I expected

For the page not query every sites plugins.

What happened instead | Screenshot / Video

image

Context / Source

dogfooding

cc: @psealock
Since I think it is related to https://github.com/Automattic/wp-calypso/pull/17590

Stats [Type] Bug

Most helpful comment

@psealock Per the comment above, there are actually two separate (new) flags you can use from /me/sites.

options.is_wpcom_store (AT + WC)
options.woocommerce_is_active (WC)

All 3 comments

All the plugins are loaded so that changing sites from one store enabled site to a non-store enabled site does not break navigation.

We could hold off on querying the plugins until after the user clicks "Switch Site", but that isn't ideal because it might prevent a click if the plugins haven't returned yet.

One possible solution would be to always go to site stats when switching from one store to another.

I'll look into this one.

Another solution would be to query the shadow site and add the data that you need to the /me/sites api endpoint.

We already store the list of active plugins on in the shadow DB so you wouldn't need a query an api call to get that info.

@psealock Per the comment above, there are actually two separate (new) flags you can use from /me/sites.

options.is_wpcom_store (AT + WC)
options.woocommerce_is_active (WC)

Was this page helpful?
0 / 5 - 0 ratings