Improve experience with recoverable modules for view-only users
See original GitHub issueFeature Description
Bug bash issue: https://app.asana.com/0/1202258919887896/1202445528223671 please refer to Asana issue for background
Improve the messaging & experience if an admin has connected a module, shared access, and then disconnects. If an admin has connected a module (ie. Analytics), shared view only access with other roles (include admins), and then disconnects they’ll be presented with an option to “Set Up” Site Kit or to access “View only” data.
If they choose to only view the data they’ll encounter the below message, which isn’t the most suitable (screenshot):
Data error in Analytics Site Kit can’t access the relevant data from Analytics because you haven’t granted all permissions requested during setup.
The reason is not suitable is that the user did provide access previously but they disconnected. They do actually have access to the Analytics property but they need to re-do the plugin setup, and there is no obvious link to do so (after choosing the “view only” dashboard).
The only way for the admin to re-do plugin set up is to click on the “View only” link and then “Sign in with Google” option. This isn’t very obvious, and would likely lead to many admins resetting the plugin.
Improved recording of experience - showing all 3 CTA’s on the dashboard after disconnecting
Steps to recreate:
- Connect SK with Google Analytics
- Share Google Analytics with all roles
- Disconnect from Site Kit
- You’ll be present with the option to set up Site Kit once more, this time with 3 options (which can be confusing)
- Select the option to “View limited data”
- You’ll encounter the error, with no obvious way out other then that mentioned above
Related to #5354
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When a module is in a recoverable state, all widgets associated with it (via their registration) should be replaced by a new component when viewed in the context of the view-only dashboard.
- The recoverable state should look similar to the
Data Unavailablestate of the widget but has different title and message. - The title should be
Data Unavailable - The message should be
{Module} data was previously shared by an admin who no longer has access. Please contact another admin to restore it.- For widgets that require multiple recoverable modules, the message should read slightly differently:
The data for the following modules was previously shared by an admin who no longer has access: {Module1, Module2, ...}. Please contact another admin to restore it.
- For widgets that require multiple recoverable modules, the message should read slightly differently:
- The recoverable state should look similar to the
- The new component when rendered should be treated as a special widget state, similar to gathering data, which when multiple adjacent widgets render the same state, they are combined into a single widget automatically
- Unlike other special widget states, this should be handled outside of the registered widget components but handled automatically by the widget infrastructure based on a widget’s registered
modulesand the current set of recoverable modules
Implementation Brief
- Add a new
RecoverableModulescomponent which takesmoduleSlugs(string[]module slugs) as a prop- Renders a
CTAwith the title and message as defined in the AC informing about the recoverable modules
- Renders a
- Add a new
WidgetRecoverableModulescomponent, similar toWidgetReportErrorwhich rendersRecoverableModules(passing through its props to it) and uses theuseWidgetStateEffecthook internally to set the widget state on mount usingRecoverableModulesas the component andmoduleSlugsas themetadata - Update
WidgetRendererto conditionally override thewidgetElementwith aWidgetRecoverableModulesifwidget.modulescontains any recoverable modules, if so, passing the intersection of module slugs asprops.moduleSlugstoWidgetRecoverableModules- Note this should only happen in a view-only context (
useViewOnly)
- Note this should only happen in a view-only context (
- Add the
RecoverableModulesto the list of special widget states
Test Coverage
- Add Jest tests to cover the basics of this functionality (essentially the alternate component rendered in place of the widget’s registered component);
- A basic test covering widget combination for adjacent widgets with the same state + metadata
QA Brief
- Site up Site Kit and enable the
dashboardSharingfeature flag. - Put the Search Console and PageSpeed Insights modules into the recoverable state. This can be achieved by sharing them as a user and then disconnecting that user from Site Kit.
- View the Dashboard in view-only mode with a user whose role the modules were shared with.
- Widgets for the recoverable modules should be rendered using the
RecoverableModulescomponent:

Changelog entry
- Update view-only dashboard to use a new placeholder for widgets that rely on recoverable modules.
Issue Analytics
- State:
- Created a year ago
- Comments:14 (2 by maintainers)

Top Related StackOverflow Question
Thanks @aaemnnosttv, sounds like a plan.
Update: I have created a follow-up issue for the multiple modules case: https://github.com/google/site-kit-wp/issues/5466
Thanks for raising this @techanvil – I think at one point the engine combined widgets based on equivalent
metadatarather than checking specific properties within it so I missed this detail when writing the IB.In the interest of not increasing the scope here (and because most widgets have only a single module), I would suggest we join the widget’s modules into a single
moduleSlugstring when constructing themetadata, essentially shoehorning it into the current logic. This is a bit of a hack but it should be harmless and have the intended effect for most widgets. We can then open a follow-up issue for how we want to handle this for multi-module widgets.