[wp-meta] [Making WordPress.org] #470: Add Infinite Scrolling to WordPress Events plugin

Making WordPress.org noreply at wordpress.org
Mon Jan 5 20:45:24 UTC 2015


#470: Add Infinite Scrolling to WordPress Events plugin
-------------------------+-------------------------------------------------
  Reporter:  iandunn     |      Owner:
      Type:              |     Status:  new
  enhancement            |  Component:  make.wordpress.org / P2
  Priority:  normal      |   Keywords:  needs-patch good-first-bug needs-
Resolution:              |  testing dev-feedback
-------------------------+-------------------------------------------------

Comment (by iandunn):

 Thanks Utkarsh and Deven, here are a few things that can be improved:

 * Don't remove braces from single-line statements inside conditions -
 https://make.wordpress.org/core/handbook/coding-standards/php/#brace-
 style. In general, it's a bad idea to make changes that are unrelated to
 the ticket, because they add diff noise and prevent an organized and
 logical commit history.
 * `$off` should be validated to make sure it's an integer
 * `$off` isn't a meaningful variable name; use `$offset` instead.
 * Instead of `wp_die()`, use `wp_send_json_success()` and
 `wp_send_json_error()`
 * Instead of returning the HTML output, just return the JSON-encoded data,
 and then build the elements in JavaScript, based on a template. See
 https://lkwdwrd.com/wp-template-js-templates-wp/ for a tutorial.
 * Add the parameter type for `$offset` in the phpDoc
 * Follow the coding standards for variable declaration at the beginning of
 JavaScript functions.
 * Prefix the `infinite_scroll` action to avoid conflicts with other
 plugins
 * Is `async_infinite_load()` triggered when the user scrolls to within
 10px of the bottom? If so, that should be more like 300px, so that there's
 plenty of time for the HTTP request to return before the user gets to the
 end of the page
 * The JavaScript should be wrapped in a literal to avoid
 variables/functions being global.

 Also, since most of WordPress.org has a footer, we probably trigger
 `async_infinite_load()` when the user clicks on a 'Load More Events'
 button, rather than automatically. If it's automatic, then the user won't
 be able to reach the footer until they scroll through an unreasonable
 number of "pages."

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/470#comment:6>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list