WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#31812 closed defect (bug) (fixed)

Remove excess debounce + bind calls

Reported by: evansolomon Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.1
Component: General Keywords: has-patch
Focuses: ui, accessibility, javascript Cc:

Description

The function being called (doSearch) is already debounced and in the correct this context. Calling _.debounce(someFunction, timeout)(args) is essentially the same thing as setTimeout(function () {someFunction(args)}, timeout), which doesn't really make sense here.

Since doSearch is already debounced there's no reason for delaying the call to it, and which point there's no reason for binding to the current context, at which point it can just be a plain old boring function call.

Attachments (1)

remove-useless-debounce-and-bind.diff (424 bytes) - added by evansolomon 6 years ago.

Download all attachments as: .zip

Change History (5)

#1 @afercia
6 years ago

  • Focuses ui accessibility javascript added
  • Keywords has-patch added
  • Version set to 4.1

Please see related #26600, should be considered for commit together.

This ticket was mentioned in Slack in #core by helen. View the logs.


6 years ago

#3 @azaozz
6 years ago

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

In 31995:

Themes screen: remove extra debounce when searching.
Props evansolomon. Fixes #31812.

#4 @azaozz
6 years ago

  • Milestone changed from Awaiting Review to 4.2
Note: See TracTickets for help on using tickets.