Premium Analytics: fix dashboard global error provider#50020
Conversation
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
|
I guess the open question from me regarding this is whether the existing ErrorProvider is what will actually be used in this iteration of anaytics (or does it need improvements as well). Feel free to review/improve and merge since I will be away this week. |
Fixes #
Proposed changes
GlobalErrorProviderso dashboard widgets can calluseGlobalError()without logging the provider warning.This PR is needed because the live dashboard route rendered
WidgetDashboarddirectly, while dashboard widgets use the shared widget error hook, which reads fromuseGlobalError(). Storybook already wrapped dashboard-hosted widget stories inGlobalErrorProvider, so the warning only appeared in the live dashboard route.The problem was surfaced while testing the current Premium Analytics dashboard on trunk: the browser console reported
useGlobalError was called outside of GlobalErrorProvider. Wrap your component tree with GlobalErrorProvider.Tracing that warning showeduseWidgetError()callinguseGlobalError()from widget code, with the live route missing the provider wrapper.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm --filter @automattic/jetpack-premium-analytics typecheck.pnpm --filter @automattic/jetpack-premium-analytics build.useGlobalError was called outside of GlobalErrorProvider.