headstartwp
headstartwp copied to clipboard
When using getServerSideProps with addHookData the page loses the usePost info
trafficstars
Describe the bug
When using getServerSideProps with addHookData the page loses the usePost info
Steps to Reproduce
Context:
- using
getServerSideProps(full SSR site) - I have to extend the
addHookDatawith props to manually inject theusePostresult, otherwise, it's removed.
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
When you say "the page loses the usePost info" do you mean you are not able to use usePost hook?
By design you should not be able to access the post data directly from props but only from the hooks.
In the pages router, you need to pass the exact same params both on the server and on the client, see the example here: https://github.com/10up/headstartwp/blob/develop/projects/wp-nextjs/src/pages/%5B...path%5D.tsx#L106