Skip to content

Dataviews: Pattern previews throw an error when changing sort order #64863

Open
@talldan

Description

Description

This may also be reproducible with templates/pages, but I generally don't have enough to trigger in pagination.

Step-by-step reproduction instructions

  1. Open the site editor
  2. Open patterns (and have the category set to All Patterns)
  3. Change the Sort Order to ascending
  4. Notice that some of the patterns (possibly the ones that weren't shown prior to changing the sort order?) shown an error and the browser console logs:
index.js:145 Uncaught TypeError: Cannot destructure property 'documentElement' of 'contentDocument' as it is null.
    at HTMLIFrameElement.onLoad (index.js:145:12)

This also seems worse when changing the Items Per Page to 100 prior to changing the sort order.

Another observation is that when the Patterns page loads the first time it has a random sort order (I guess whatever's returned by the REST API, possibly creation order?). You can change the sort order to alphabetical, but then there's no way to go back other than reloading the page. It makes me wonder what the purpose of the initial sort order is.

Screenshots, screen recording, code snippet

Screenshot 2024-08-28 at 5 32 21 PM

Environment info

Mac OS / Brave
Reproduced on latest trunk

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Metadata

Assignees

No one assigned

    Labels

    [Package] DataViews/packages/dataviews[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions