-
Notifications
You must be signed in to change notification settings - Fork 9
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
custom response and constructor props for SSR pages #1177
Comments
thescientist13
changed the title
custom response and constructor props for pages
custom response and constructor props for SSR pages
Nov 3, 2023
This was referenced Jan 14, 2024
16 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Coming out of #952 , where in we introduced Web Server Components, that took in an instance of
Request
as a constructor propWe would want to make sure we could compliment this with the ability to "customize" the response, in addition the already provided HTML. This would be useful for pages, especially in the case of response headers, for setting things like:
Set-Cookie
)In addition, being able to customize constructor props would be nice, to encompass all that data fetching / massaging outside of the component definition, where things could awkward within the limitation of a synchronous constructor and could make unit testing easier through dependency injection.
Details
As seen in #880, I think a custom "loader" function could be used for a double-purpose here, in that the
loader
function can be a mechanic for hydration, in that the user can return some JSON serialiaziable data, and we can inline that into the HTML of the page as well as pass it in as a custom constructor prop.From there, perhaps we can also define an instance of
Response
to be returned, and then we can just extract / merge everything but the body, so that something like this could be possible?I'm not quite sure how to reconcile this with #880 where all we care about is the custom prop, so not sure we can get this all from a
Response
, or maybe we can just pass in a mutable reference to theresponse
being managed by Greenwood? 🤔The pilot for this can be Lit's SSR hydration support added in #1201
The text was updated successfully, but these errors were encountered: