Closed wesleybl closed 1 week ago
@wesleybl It's related to the server-side rendering of the listing block, see https://6.dev-docs.plone.org/volto/blocks/ssr.html
It's probably a bug, that code needs to be brought more in line with the rest of the listing block data fetching preparations.
@tiberiuichim i'm trying to modify the listing block, to return more calalog metadata. But I saw that there are requests in getAsyncData.js and in withQuerystringResults.jsx. Which of these files should I make changes to? Or on both?
@wesleybl both.
getAsyncData is only used on the server-side rendering path. It's meant to populate the Redux store that will be used by the listing block components. Here's a page that hopefully will explain this mechanism: https://training.plone.org/effective-volto/addons/asyncconnect.html
withQuerystringResults is used by the listing block to fetch the data.
In principle these two functions should produce exactly the same query (pagination excluded, as there's no URL-based set current page). If they don't, it's a bug in the getAsyncData and should be fixed.
@tiberiuichim as I understand it, this is a mechanism to prevent the page from loading without the listing. But on the Browser side, the listing can be modified, after server rendering. That's it?
Well it looks like the way it is today, when we don't have a criterion, nothing is rendered on the server side (getAsyncData.js
), since the query parameter is empty here (causing the described error).
The listing only appears because withQuerystringResults.js
has a fallback:
when we don't have query.
It may be necessary to create a "default query", both in withQuerystringResults.js
and in getAsyncData.js
, when there is no query. Maybe in editing this "default query" should already be saved.
@tiberiuichim @sneridagh any opinions here? I propose the default query:
const defaultQuery = [
{
i: 'path',
o: 'plone.app.querystring.operation.string.relativePath',
v: '::1',
},
];
when we have no defined criteria. This query will have the same result as the items key of the content.
@wesleybl Ok, +1
Describe the bug When we load a page that has a listing block, without a search criteria, we get the error below in Plone:
Who makes this call is getAsyncData.js
It sends the
query
parameter as an empty list.It looks like it's an attempt to render the block server-side, but I don't quite understand it. The fact is that the block works without getAsyncData. So I'm not quite sure what the idea is here.
To Reproduce Steps to reproduce the behavior:
Expected behavior No error in Plone.
Software (please complete the following information):