Newsletter: fix editor email stats timeout flashing errors (NL-578)#48002
Newsletter: fix editor email stats timeout flashing errors (NL-578)#48002
Conversation
… drafts The Newsletter panel's getTotalEmailsSentCount resolver has a hard 5s timeout. On large sites the WPCOM stats/opens/emails endpoint can exceed that, and the resolver surfaced the error as a snackbar in the editor — flashing "cURL error 28" on every load. It also fired for brand new drafts that had never been sent. - Fail silently on fetch errors; open rate is informational and should never flip api state or raise an editor notice. Log to console.warn instead. - Only trigger the fetch for already-published posts (status === 'publish'). - Extend resolver tests to cover timeout/reject and WP_Error paths. Fixes NL-578. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
Fixes NL-578
Proposed changes
getTotalEmailsSentCountresolver now fails silently on error instead of dispatching a snackbar notice + flipping api state to disconnected. Email open rate is purely informational and should never surface as an editor error. Errors are logged toconsole.warnfor debuggability.subscribers-affirmation.js) now only triggers the email-open-rate fetch whenstatus === 'publish'. Drafts, auto-drafts, pending, and scheduled posts have never been emailed, so the request would be a guaranteed miss (and contributed to the timeouts reported in the ticket).resolvers-test.jswith coverage for the rejected-promise (timeout) path and to assert the WP_Error path no longer callsonError/dispatches.Other information
The WPCOM
stats/opens/emails/{post}/rateendpoint has a hard-coded 5s timeout on the client. On large sites (e.g. seths.blog, 147199084) the request regularly exceeds that, flashingcURL error 28in Gutenberg on every editor load.The ticket also mentions
/stats/emails/summarytiming out on the Jetpack Stats dashboard Newsletter tab. That lives in the stats-admin package and is a separate surface — not fixed here; happy to open a follow-up.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Unit tests
pnpm jest extensions/store/membership-products/test/resolvers-test.js— 9/9 passingpnpm jest extensions/shared/memberships/test/subscribers-affirmation-test.js— 39/39 passingManual — error no longer flashes
wp-content/mu-plugins/force-stats-timeout.phpto force the timeout:Manual — no fetch on drafts
stats/opens/emails.Manual — still works on published posts
To test on Simple, sandbox the Simple site and public api.
🤖 Generated with Claude Code