[wp-trac] [WordPress Trac] #28326: List Tables don't update properly after Quick Edit

WordPress Trac noreply at wordpress.org
Tue Apr 16 20:18:28 UTC 2019


#28326: List Tables don't update properly after Quick Edit
---------------------------------+-----------------------------------------
 Reporter:  wonderboymusic       |       Owner:  (none)
     Type:  defect (bug)         |      Status:  reopened
 Priority:  normal               |   Milestone:  Awaiting Review
Component:  Quick/Bulk Edit      |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  bulk-reopened has-   |     Focuses:  javascript, administration
  patch                          |
---------------------------------+-----------------------------------------

Comment (by birgire):

 Thanks for the patch @garrett-eclipse

 I tested [attachment:"28326.2.diff"] for few cases:

 1) No existing sticky posts.
 - Table nav contains no Sticky link
 - Quick edit same post.
 - Mark it as sticky.
 - Press Update.
 - We don't get Sticky (1) in table's nav as expected.

 2) One existing sticky post.
 - Table nav contains Sticky (1) link
 - Quick edit same post.
 - Mark it as non-sticky.
 - Press Update.
 - We get Sticky (0) in table's nav (Should it be removed?).
 - We have to refresh page to remove Sticky (0) in table's nav.

 3) One existing sticky post.
 - Table nav contains Sticky (1) link
 - Quick edit another post.
 - Mark it as sticky.
 - Press Update.
 - We get Sticky (2) in table's nav, as expected.
 - When we refresh page we also get Sticky (2) in table's nav.


 In [attachment:"28326.2.diff"] I noticed the debugging parts of:

 {{{
 console.log(rowData);
 console.log(was_sticky);
 console.log(r);
 console.log(is_sticky);
 }}}

 For consistency with camelCase, I would suggest {{{wasSticky}}} and
 {{{isSticky}}} variable names,
 instead of {{{was_sticky}}} and {{{is_sticky}}}.

 Then the docblocks could be added for the three methods.

 I first wondered about the difference between was- and is- sticky
 formulation:

 {{{
 was_sticky = $( '.sticky', rowData ).text() === 'sticky';
 is_sticky = -1 !== r.indexOf( '<div class="sticky">sticky</div>' );
 }}}

 but this is because r (the ajax post response) is a string but rowData is
 an dom object.

 I wonder if it could use:

 {{{
 is_sticky = $( '.sticky', r ).text() === 'sticky';

 }}}

 to skip the exact HTML code reference and to make the is- and was- checks
 similar? That seems to be working from quick testing.

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


More information about the wp-trac mailing list