Closed htmgarcia closed 2 years ago
There is a delay of 5 or 6 seconds before the block start loading. This happens on Appearance > Widgets, but not in post edit.
hasPosts
value is 0
until changes to false https://github.com/publishpress/PublishPress-Blocks/blob/ppb-655/src/assets/blocks/recent-posts/block.jsx#L836-L837
@contactashish13 any idea what could be causing this delay?
@contactashish13 when you have a chance, please let me know if you were able to debug this one, please.
@htmgarcia on it today!
@htmgarcia the behavior is slightly different in posts and widgets. It appears that in widgets calling getEntityRecords returns an empty array in widgets but a null in posts. That is why the transition from 0 to false/null to a positive number in widgets but in posts it goes from false/null to a positive number.
Could it because because of cached data? I tried to add a random timestamp parameter custom_pp
to recentPostsQuery
to burst the cache but that doesn't work either.
edit b4 getEntityRecords undefined {order: "desc", orderby: "date", per_page: 8, custom_pp: 1630400474133}
edit after getEntityRecords undefined {order: "desc", orderby: "date", per_page: 8, custom_pp: 1630400474133} []
edit b4 getEntityRecords undefined {order: "desc", orderby: "date", per_page: 8, custom_pp: 1630400517659}
edit after getEntityRecords undefined {order: "desc", orderby: "date", per_page: 8, custom_pp: 1630400517659} null
with the below code change
console.log('edit b4 getEntityRecords', postType, recentPostsQuery);
let x = getEntityRecords( 'postType', postType ? postType : 'post', recentPostsQuery );
console.log('edit after getEntityRecords', postType, recentPostsQuery, x);
@contactashish13 tweaking the code to detect when the block is in widget area or post edit. Would that help?
@htmgarcia yeah that was my first thought too but I couldn't find anything elegant that would allow that. I can always check if I'm inside the widget DOM but that seemed like a hack to me. Let me know if you have a better idea.
Fixed with #800 and possibly in combination with #797
The Content Display takes some time to display the actual content in Appearance > Widgets in WP 5.8 RC-4 This could be an issue introduced by us at some point to make sure when switching the filters for CPT are applied to the preview in regular post editor.
Several seconds later displays the content: