vike: Allow `addContextProps()` to be called on the client-side. (For page transitions that happen 100% in the client and where the server is not invovled at all.)
Currently addContextProps() is defined in .page.server.js and always called in Node.js which is an important invariant for people who use SQL/ORM queries in their addContextProps() functions.
This ticket is about enabling addContextProps() to be called in the browser by defining it in .page.js instead of .page.server.js. It would still always be called in Node.js when rendering a page to HTML, but for any susequent page navigation addContextProps() would be called in the browser (when using useClientRouter()).
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (16 by maintainers)
This ticket is actually about addressing this. Currently
addContextProps()is defined in.page.server.jsand always called in Node.js which is an important invariant for people who use SQL/ORM queries in theiraddContextProps()functions. This ticket is about enablingaddContextProps()to be called in the browser by defining it in.page.jsinstead of.page.server.js.Clarifying things is a top priority. Proper documentation will go in a long way in clearing things out.
Yeah, being able to define everything in
*.page.tsfiles would be so great. When I stumbled across this project my immediate thought was “I could make a clone of Remix with this” https://remix.run/ I really like the clean API they have https://www.youtube.com/watch?v=4dOAFJUOi-s&t=1281s