Opened 9 years ago
Closed 9 years ago
#32035 closed defect (bug) (fixed)
Media views EmbedLink debounce
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.1 |
Component: | Media | Keywords: | has-patch |
Focuses: | ui, javascript | Cc: |
Description
Not sure the current usage of _.debounce
is correct when embedding a link from "Insert from URL". To my understanding, the updateoEmbed
function should not be debounced and fetch
should be debounced instead.
See discussion about _.debounce
on #26600
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
_.debounce
is correctly placed on the typing callback. The real issue is stampede of XHRs onfetch()
. These aren't necessarily a problem, but the browser shouldn't try to handle all of them.If a
fetch()
is happening, and another one is triggered, the currently pending XHR should be aborted. You can't callabort()
on$.Deferred
, but you can on$.ajax
, so we will use that instead ofwp.media.ajax
, which returns a deferred Promise.