boonebgorges / buddypress-docs

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

Issues when Heartbeat API is switched off for the frontend #704

Closed pixelshrink closed 2 years ago

pixelshrink commented 2 years ago

If you completely switch off Heartbeat API (to improve site performance) for the frontend using a plugin like Litespeed Cache or Heartbeat Control, the metadata boxes like Associated Group, Access, Categories etc won't display when editing a doc.

I realise many ajax functions are affected by switching off Heartbeat API, but it would be very helpful if this functionality would work independent of Heartbeat API being disabled.

WP version: 3.8.3 BP Docs version: 2.1.6

boonebgorges commented 2 years ago

Hi @pixelshrink - You're right, there's no reason why this dependency has to be there. There's already some logic in the JS to degrade gracefully if wp.heartbeat is not there. The problem here is that the wp_register_script() call for buddypress-docs made our JS dependent on 'heartbeat', and if these plugins disable heartbeat by suppressing the core script, then it causes the bp-docs-js script not to load at all. I've rearranged things in ea09b22 so that this no longer happens. Maybe you could give it a test to confirm.

pixelshrink commented 2 years ago

Hi, thanks for this, sorry for the delay. I can confirm that this works both on the edit doc and add new doc pages.

boonebgorges commented 2 years ago

Thank you for confirming!

dcavins commented 2 years ago

It seems that this fix doesn't solve the issue on a Siteground-hosted site: https://wordpress.org/support/topic/attach-button-does-not-work/

Or maybe there's another conflict, though the base description of the issue sounds like a match: • works perfectly on localhost • blows up when site moved to Siteground