-
Notifications
You must be signed in to change notification settings - Fork 0
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
RFC: Render context/data. #20
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, it's hard to explain what the Session object is for. It may be handling too many use cases.
I think
session
is a good name considering its lifecycle, i.e. it's a place to store stuff for the duration of a browser session (or server request), and it includes methods related to that (hooks, refresh).But there is one use case in particular which doesn't quite fit. Passing data between middlewares during a single page render.
The most obvious example is using a middleware for the Layout component and another for the actual page. How can a particular page modify (pass a prop to) the layout component?
Another open question is where document properties live, e.g. page title, meta tags. Is that a property of the session, or a specific render.
My proposal is to pass a new page object as the second argument to each middleware's inner function.
If we decide to put document properties there, it can be sent to render hooks as well:
I would like to return this object from
renderServer
so it can be used to render the Document, but I'm not sure how.The text was updated successfully, but these errors were encountered: