You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use WP's Heartbeat API to power the 'Are you still editing?' feature. But this causes problems when Heartbeat is disabled broadly, as it is by WPEngine and perhaps others. See #477.
In these cases, we should fail more gracefully. I think this means something like this:
Don't make the main bp-docs js files dependent on 'heartbeat' when enqueuing scripts. Attempt to load it separately.
In JS, check that heartbeat is available before initializing the 'idle' checker.
The text was updated successfully, but these errors were encountered:
Boone, I wanted to check with WP Engine directly to understand what they're doing. After some back and forth with their support staff, they sent me their logic that deregisters heartbeat on most pages. Here it is:
A class for throttling back the heartbeat of a WordPress page. This class controls
the heartbeat rate and even disables the heartbeat for all pages except post editing
pages.
*/
class WPE_Heartbeat_Throttle {
/**
Register the actions/hooks that make this throttle work.
*/
public function register() {
add_action( 'init', array( $this, 'check_heartbeat_allowed' ), 1 );
}
/**
Check that heartbeat is allowed for this page and deregeister it if not.
*/
public function check_heartbeat_allowed() {
global $pagenow;
/**
Filter the pages where heartbeat.js is allowed to load.
@param array $heartbeat_allowed_pages Array of pages where the heartbeat.js file is allowed to be loaded.
*/
$heartbeat_allowed_pages = apply_filters( 'wpe_heartbeat_allowed_pages', array( 'edit.php', 'post.php', 'post-new.php', 'site-health.php' ) );
I was thinking we could get in before their code runs to unhook it on our edit pages, but init at 1 is pretty early. I've asked if they could just use wp_dequeue_script instead of deregistering it. Otherwise, we could just re-register it when we need it.
Thanks for researching this. I think it's worth thinking about this as a specific solution for people who are on WPE and want to have the heartbeat functionality turned on for buddypress-docs. Maybe a useful thing for the wiki. But I still think we need to have a more graceful failure, as there are likely to be cases where heartbeat is disabled in ways other than this.
We use WP's Heartbeat API to power the 'Are you still editing?' feature. But this causes problems when Heartbeat is disabled broadly, as it is by WPEngine and perhaps others. See #477.
In these cases, we should fail more gracefully. I think this means something like this:
The text was updated successfully, but these errors were encountered: