[wp-trac] [WordPress Trac] #53171: Total number of attachments not updated when attachment uploaded

WordPress Trac noreply at wordpress.org
Mon Jun 21 20:04:04 UTC 2021


#53171: Total number of attachments not updated when attachment uploaded
-------------------------------------+-------------------------------------
 Reporter:  joedolson                |       Owner:  joedolson
     Type:  defect (bug)             |      Status:  accepted
 Priority:  normal                   |   Milestone:  5.8
Component:  Media                    |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  javascript,
  2nd-opinion                        |  administration
-------------------------------------+-------------------------------------

Comment (by adamsilverstein):

 @joedolson Adding handlers for add and remove does seem like a very
 standard way of syncing collection state in Backbone apps. I tested the
 patch adding and removing single and multiple images and the image count
 in the footer always stayed synced with the collection.

 I did notice one issue: a couple of my image uploads failed (images were
 too large). In the console, I see an error "Uncaught TypeError: Cannot
 read property 'totalAttachments' of undefined" on L643, the call to
 this.mirroring.totalAttachments = this.mirroring.totalAttachments - 1

 So I think we need to add a conditional in _removeFromTotalAttachments
 like you have in the add handler.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53171#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list