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

Page List block shows loading state often, doesn't seem to cache page data #36502

Closed
talldan opened this issue Nov 16, 2021 · 4 comments · Fixed by #36531
Closed

Page List block shows loading state often, doesn't seem to cache page data #36502

talldan opened this issue Nov 16, 2021 · 4 comments · Fixed by #36531
Labels
[Block] Page List Affects the Page List Block [Type] Bug An existing feature does not function as intended [Type] Performance Related to performance efforts

Comments

@talldan
Copy link
Contributor

talldan commented Nov 16, 2021

Description

The page list block doesn't seem to cache the data it uses. When editing I notice it shows a loading spinner regularly, even if the data is unchanged.

Usually requests to the REST API via the core-data package's API (e.g. getEntityRecords) are cached, so I wouldn't expect this problem.

Step-by-step reproduction instructions

  1. Add a page list block and observe the loading spinner
  2. Add a second page list block and observe the loading spinner again, even though the data is the same as the first block
  3. Open dev tools to the network tab
  4. Add more page list blocks, observe that each block makes an identical request to the REST API when it could rely on cached data.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress trunk
  • Gutenberg trunk
  • Brave on Mac OS

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

@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] Page List Affects the Page List Block [Type] Performance Related to performance efforts labels Nov 16, 2021
@Mamaduka
Copy link
Member

The block uses apiFetch instead of the entity selectors.

@talldan
Copy link
Contributor Author

talldan commented Nov 16, 2021

The block uses apiFetch instead of the entity selectors.

I wonder why, I couldn't see any discussion about it on #31670.

@noisysocks @georgeh any recollection?

@georgeh
Copy link
Contributor

georgeh commented Nov 16, 2021

Sorry I don't recall the specifics of why it's using apiFetch. Looking at the diff, I would guess it's because the existing code was already using apiFetch.

@Mamaduka
Copy link
Member

Thanks for the clarification, @georgeh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Page List Affects the Page List Block [Type] Bug An existing feature does not function as intended [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants