Opened 11 years ago
Closed 11 years ago
#32035 closed defect (bug) (fixed)
Media views EmbedLink debounce
| Reported by: | afercia | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.3 |
| Component: | Media | Version: | 4.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | ui, javascript |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
_.debounceis 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.