[wp-trac] [WordPress Trac] #57914: CPT created during the same second can be retrieved by the API in the wrong order

WordPress Trac noreply at wordpress.org
Mon Mar 13 15:17:03 UTC 2023


#57914: CPT created during the same second can be retrieved by the API in the wrong
order
--------------------------+-----------------------------
 Reporter:  onemaggie     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.1.1
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 This bug was uncovered while writing an e2e test for the navigation block
 (https://github.com/WordPress/gutenberg/pull/48132#discussion_r1130847269).

 When the navigation block retrieves the latest navigation from the
 database, the API will return the oldest one if they were created during
 the same second
 (https://github.com/WordPress/gutenberg/blob/621c2556e843c7c2c0210e13115d29026f6854c4/packages
 /block-library/src/navigation/use-navigation-menu.js#L98)

 This will only happen when the CPT are created programmatically. To
 reproduce this, run the e2e test from
 https://github.com/WordPress/gutenberg/pull/48132 ('default to my most
 recently created menu') without the timeout between the creation of the
 two menus. Without said timeout, the API returned the oldest one instead
 of the newest one.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57914>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list