Added expandable in site endpoint
@davisagli Is there any reason why this hasn’t been implemented yet? I mean, it was there but not wired up… We need this for Seven, and eventually for Volto.
📚 Documentation preview 📚: https://plonerestapi--1947.org.readthedocs.build/
@sneridagh thanks for creating this Pull Request and helping to improve Plone!
TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
@jenkins-plone-org please run jobs
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.
Happy hacking!
@jenkins-plone-org please run jobs
@sneridagh We intentionally removed it from the PR that added the site endpoint: https://github.com/plone/plone.restapi/pull/1465#discussion_r1209590386
My reasoning was that it is an anti-pattern because the site data should be fetched once on the SSR load, and not every time new content is fetched.
There is a tradeoff because if it's only fetched on the initial load, it might get out of date if settings that affect the site data are changed later. So I can see the argument for making it available as an expander -- but I still don't like that it does extra work on every content request that isn't needed in most cases.
Can you say more about how you plan to use it in Seven and why it's not sufficient to use the separate endpoint?
@davisagli I understand your point, that's why we should put some memoization in place, so if the attributes do not change, then you don't do the work again.
Why this can't be done in Seven? Because HTTP and how modern SSR works where all requests are isolated from each other. In Volto this can be done because Redux store. I don't want such a thing or poor man replacement in Seven.
In Volto are you aware that since the TTW settings that we are pushing in there, eg. you change the square images setting. It does not take place until you reload the whole app? This would fix it.
@davisagli btw, the memoization, could you please help me with it? I'd like to have this soon, so Volto and the distributions can also benefit from it.