Make WordPress Core

Opened 16 months ago

Closed 16 months ago

Last modified 15 months ago

#57914 closed defect (bug) (duplicate)

CPT created during the same second can be retrieved by the API in the wrong order

Reported by: onemaggie's profile onemaggie Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.1.1
Component: Posts, Post Types Keywords:
Focuses: rest-api Cc:

Description

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.

Change History (6)

#1 @pbiron
16 months ago

Thanx for the ticket.

I suspect this is the same (or at least a related) issue as #44349.

#2 @johnbillion
16 months ago

Yeah, same underlying "indeterminate sort order" issue as #47642 too.

#3 @SergeyBiryukov
16 months ago

  • Component changed from General to Posts, Post Types

This ticket was mentioned in Slack in #core-test by juhise. View the logs.


16 months ago

#5 @juhise
16 months ago

  • Resolution set to duplicate
  • Status changed from new to closed

Thanks @onemaggie for reporting this, this has been reported already in #47642.

#6 @desrosj
15 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.