WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#30008 closed enhancement (fixed)

De-registering heartbeat script causes meta boxes to become unresponsive

Reported by: wycks Owned by: azaozz
Milestone: 4.1 Priority: normal
Severity: normal Version: 4.0
Component: Script Loader Keywords: has-patch
Focuses: javascript Cc:
PR Number:

Description

Using

wp_deregister_script('heartbeat');

Causes the metabox fields under the default editor to not close on click and they are not draggable. Tested on WordPress 4.0 twenty-twelve and several other themes.

Steps to reproduce.

  1. Call wp_deregister_script('heartbeat'); on init.
  2. Go to any post/page/cpt and try to close/open or drag a meta box (excerpt, revision, discussion, comments, etc).

Attachments (1)

30008.patch (2.1 KB) - added by azaozz 5 years ago.

Download all attachments as: .zip

Change History (8)

#1 @DrewAPicture
5 years ago

  • Component changed from General to Script Loader
  • Focuses javascript added

#2 @azaozz
5 years ago

Happens because post.js (containing most of the JS for the Add/Edit Post screen) requires heartbeat.js. If the latter doesn't exist, the former is not loaded.

We probably can change that requirement, however heartbeat is needed for autosave, auth-check, post locks, etc. Deregistering it will disable all of them. If the purpose is to reduce AJAX requests, opened #29779 for a better way.

Thinking this should be 'wontfix' in favor of #29779.

#3 @wycks
5 years ago

It's a bit of an odd situation when these components are coupled together, one would not expect the heartbeat to effect elements not directly related to heartbeat. We recently just reduced requests by changing the timer instead of deregistering the script, I just found it odd it would cause that bug. Feel free to close.

#4 @azaozz
5 years ago

  • Milestone changed from Awaiting Review to 4.1
  • Type changed from defect (bug) to enhancement

Thinking more about this: we can "decouple" heartbeat from other scripts that can work without it. In practice only autosave.js requires it.

@azaozz
5 years ago

#5 @azaozz
5 years ago

  • Keywords has-patch added

In 30008.patch:

  • Remove 'heartbeat' dependency for post.js and inline-edit-post.js. They can function correctly (with reduced functionality) when heartbeat is not loaded.
  • Fix dependencies for autosave.js.

#6 @SergeyBiryukov
5 years ago

+1 for 30008.patch, I saw a request on support forums today similar to this ticket.

#7 @azaozz
5 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 29989:

Script-loader: remove 'heartbeat' dependency for post.js and inline-edit-post.js, fix dependencies for autosave.js. Fixes #30008

Note: See TracTickets for help on using tickets.