Make WordPress Core

Opened 7 years ago

Last modified 3 years ago

#43453 new defect (bug)

heartbeat_received filter requires data in order to execute

Reported by: brianscaturro's profile brianscaturro Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.6
Component: Plugins Keywords: reporter-feedback
Focuses: javascript Cc:

Description

With regards to the heartbeat api, the plugin developer handbook states:

Not every feature will need all three of these steps. For example, if you don’t need to send any data to
the server, you can use just the latter two steps.

But this does not seem to be the case given this line of of wp_ajax_heartbeat.

This makes it less useful if you just want to include some new data on an interval. It requires an approach like:

$( document ).on('heartbeat-send', (e, data) => {
  data.wouldLikeFilterToTrigger = true;
});

$(document).on('heartbeat-tick', (e, data) => {
  // do something with data generated by filter
  console.log(data);
});

If you omit the send event, the filter on the server never runs.

It seems like this constraint should be lifted, or at the very least the documentation should be updated.

Change History (1)

#1 @azouamauriac
3 years ago

  • Keywords reporter-feedback added
  • Version changed from 4.9.4 to 3.6

Hello there welcome to WordPress trac! thanks for report can you give us a case to reproduce the issue?

Thanks.

Note: See TracTickets for help on using tickets.