- Issue created by @longwave
- 🇬🇧United Kingdom longwave UK
@larowlan also noted that this method handles cache tags specially, why only cache tags and not contexts or max-age? If possible we should remove this flag entirely here.
- Merge request !385#3484678 "Improve or remove ComponentSourceInterface::getClientSideInfo()" → (Open) created by longwave
- 🇬🇧United Kingdom longwave UK
getClientSideInfo()
now returns a build array where the HTML, CSS and JS can be extracted from. I also removed the cache tags flag as I haven't seen any problems with it locally.We still need somewhere to get/put the props, slot data, and dynamic field candidates, but maybe those should become individual methods on the source plugin.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Is an array OK here or should we use a proper value object?
Thanks to 📌 Refactor XB internals to not assume /xb-components returns only SDC-powered XB Components Active , this is now a well-defined array shape.
Refactoring to a value object is fine, but what is the benefit? (Other than the well-defined array shape currently only being enforced using PHPStan, but that could easily be changed.)
Or can we even refactor this away entirely and just ask the component source plugin to render the component to a build array, and handle everything in the caller?
It's the client side that needs all the separate pieces of information; a "build array" (🤔 aka render array, right?) hence does not get us any further AFAIK.
See
ApiComponentsController
. - 🇬🇧United Kingdom longwave UK
Well, if the source plugin returns just a render array, then ApiComponentsController can be responsible for rendering it and extracting the CSS/JS, no? See https://git.drupalcode.org/project/experience_builder/-/merge_requests/3...
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Of course! 😅
Agreed that would be nicer! 👍
- 🇬🇧United Kingdom longwave UK
Locally the max-age is 1 instead of 3600 now. The original max-age is now bubbling up to the actual response even though we try to override it in the controller, but I don't see where the logic has changed for this to happen. Assigning to Wim in the hope that he has ideas or better renderer debugging skills than I do.