boonebgorges / buddypress-docs

GNU General Public License v3.0
106 stars 44 forks source link

More graceful failures when heartbeat.js is not available #687

Open boonebgorges opened 3 years ago

boonebgorges commented 3 years ago

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:

dcavins commented 3 years ago

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:

`<?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.

boonebgorges commented 3 years ago

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.