Replies: 1 comment 3 replies
-
Just bumping this - is this possible? To respond to a POST on a page end point (not api or route end point, a page end point)? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goals
Enable page handlers to answer POST requests when in draft mode.
Non-Goals
We don't want or need this for scenarios outside of draft mode. There may be an argument to add something similar for "dynamic" routes, but that's not my purpose here.
Background
I'm using Payload CMS, and that presents some challenges for their "live preview" mode with RSC. They have a solution, but it's problematic in some ways.
Solving that with its multiple stages is not super easy.
In Payload, the full content of the update is actually passed through client side. When using client rendering, this is super easy - we can actually just render that, and be done! But there are some production issues with that, which are well documented with the change to RSC (among other issues, the entire payload data block has to be serialized and sent to the client for hydration - and of course, hydration has to happen - bigger data bundle, bigger app bundle, hydration - slow, slow, slower).
BUT - what if we could POST to a page route in draft mode:
Proposal
Allow page handlers to answer POST requests. What that might look like. - accessing post body through a helper function, similar to
cookies()
orheaders()
) in draft mode - maybepostBody().json()
or something similar.Beta Was this translation helpful? Give feedback.
All reactions