Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Views > Pages: Show a preview of pages for grid view #59041

Closed
annezazu opened this issue Feb 14, 2024 · 15 comments · Fixed by #59111
Closed

Data Views > Pages: Show a preview of pages for grid view #59041

annezazu opened this issue Feb 14, 2024 · 15 comments · Fixed by #59111
Assignees
Labels
[Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond [Feature] Media Anything that impacts the experience of managing media [Package] Media Utils /packages/media-utils [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

Right now, pages is empty and doesn't show a preview, like you find on templates or patterns:

Screenshot 2024-02-14 at 3 35 49 PM

Can we add a preview of the page here? Any reason this is empty? It makes it look like something is broken or missing @WordPress/gutenberg-design

@annezazu annezazu added [Type] Enhancement A suggestion for improvement. [Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond labels Feb 14, 2024
@t-hamano
Copy link
Contributor

Unlike templates and patterns, the grid layout in Pages displays featured images in the preview area instead of content previews. Maybe we should display some kind of icon or placeholder, as suggested in this comment.

@annezazu
Copy link
Contributor Author

Hmmm there were featured images set for some of these pages though and they didn't show. Perhaps this is a bug then?

@t-hamano
Copy link
Contributor

That's strange. I was unable to reproduce this issue in WP6.5 Beta1. The issue cannot be reproduced even if Gutenberg version 17.7.0 is enabled 🤔

d98319ad81dda8d216715b6606b05a85.mp4

@annezazu
Copy link
Contributor Author

annezazu commented Feb 15, 2024

Hmm here's what it looks like with just 6.5-beta1:

Screen.Recording.2024-02-14.at.9.03.08.PM.mov

I could then replicate it with 6.5-beta1-57631.

@t-hamano
Copy link
Contributor

Just to be sure, is the featured image not displayed even when the "featured image" field is enabled in the table layout?

table-layout

@jameskoster
Copy link
Contributor

We should probably update the placeholder design a bit. When there are no featured images at all it's not entirely clear what's going on. We might use an icon, or something similar to the placeholder state you find in the editor:

placeholder

@annezazu
Copy link
Contributor Author

Just to be sure, is the featured image not displayed even when the "featured image" field is enabled in the table layout?

Correct. I don't see it there either. I'm going to mark this as a bug to be safe and add to 6.5 @colorful-tones @fabiankaegy can you all replicate by chance? To be clear, when you set featured images for pages can you see those images previewed when using data views.

@annezazu annezazu added [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Feb 15, 2024
@annezazu
Copy link
Contributor Author

We should probably update the placeholder design a bit. When there are no featured images at all it's not entirely clear what's going on. We might use an icon, or something similar to the placeholder state you find in the editor:

Opened a separate issue for this: #59098

@colorful-tones
Copy link
Member

colorful-tones commented Feb 15, 2024

I see featured images fine in the 'Manage all pages' area with new data views, and for both the Grid and Table layouts.

WP 6.5-beta1 - no plugins

'Manage all pages' Grid view 'Manage all pages' Table view
Screenshot 2024-02-15 at 3 51 50 PM Screenshot 2024-02-15 at 3 51 38 PM

WP 6.5-beta1 + Gutenberg trunk colorful-tones@d46d7a1 active

'Manage all pages' Grid view 'Manage all pages' Table view
Screenshot 2024-02-15 at 3 56 16 PM Screenshot 2024-02-15 at 3 56 06 PM

WP 6.5-beta1-57633 - no plugins

'Manage all pages' Grid view 'Manage all pages' Table view
Screenshot 2024-02-15 at 4 02 45 PM Screenshot 2024-02-15 at 4 02 33 PM

In all my testing scenarios the featured image is displaying fine. @annezazu I wonder how if it could be your testing platform? Are you using Playground?

FYI - I'm using the WordPress Beta Tester plugin to test WP 6.5 betas on Local. Just in case it helps. 🤷

@annezazu
Copy link
Contributor Author

Hmmm seems this might be a playground issue 😭 @adamziel no clue what's going on here but this is making playground less and less likely for me to use for testing features due to how unreliable it seems to be with giving a "true" environment. Going forward, I'm no longer going to use playground for testing issues related to 6.5 for this release and will try again in 6.6. It's wasting too much time for me to have to duplicate across situations and, in this case, was a collective waste of time.

Closing this out for now. Thank you all for testing and digging in here. I didn't realize how many differences there would be.

@t-hamano
Copy link
Contributor

I see, this is a problem that can be reproduced with Playground. I was able to reproduce it too 😅 However, I found that this problem can be reproduced even in a non-Playground environment. For example, if you set a very small image such as 50px as the featured image, you will be able to reproduce this problem.

Therefore, I would like to reopen this issue and submit a PR.


@adamziel, As far as I investigated, I think that one of the reasons is that the media sizes are not generated in Playground. For example, if I run wp.data.select( 'core' ).getEntityRecord( 'root', 'media', X ) in the browser console after uploading media, media_details.size will always be an empty object. Is my understanding correct?

Another reason is that Gutenberg did not consider a scenario where these sizes did not exist.

const currentSize = size.find(
( s ) => !! media?.media_details?.sizes[ s ]
);
const mediaDetails = media?.media_details?.sizes[ currentSize ];
if ( ! mediaDetails ) {
return null;
}

@t-hamano t-hamano reopened this Feb 16, 2024
@colorful-tones
Copy link
Member

@t-hamano you are amazing and nice digging to find and reproduce that bug. 👏

@colorful-tones colorful-tones added [Feature] Media Anything that impacts the experience of managing media [Package] Media Utils /packages/media-utils labels Feb 16, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 16, 2024
@annezazu
Copy link
Contributor Author

Amazing work! In sleuthing a non-bug, you found a bug 🐛 .

@t-hamano
Copy link
Contributor

The issue on Playground should also be resolved. You can test it by following the steps below.

  • Access Gutenberg PR Previewer and enter the PR number (59111)
  • From the top right panel, change the WordPress version to 6.5-beta1

#59111 should be backported to 6.5Beta2, so once Beta2 is released, you should simply launch Playground.

19b80b419e45a38a4008904a30c2cfc0.mp4

@adamziel
Copy link
Contributor

adamziel commented Mar 4, 2024

This is amazing, thank you so much @t-hamano!

if I run wp.data.select( 'core' ).getEntityRecord( 'root', 'media', X ) in the browser console after uploading media, media_details.size will always be an empty object. Is my understanding correct?

I think so! I imagine the getEntityRecord selector would synchronously return what's already in the store, and the resolver would start an asynchronous request to retrieve the information from the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond [Feature] Media Anything that impacts the experience of managing media [Package] Media Utils /packages/media-utils [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants