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.)
See original GitHub issueCurrently 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()
).
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (16 by maintainers)
Top Results From Across the Web
A set of utility functions and types to use with Remix.run - GitHub
This function is an object version of Promise.all which lets you pass an object with promises ... This part of Remix Utils needs...
Read more >How to handle not found 404 for dynamic routes in Next.js ...
A way to get a real "HTTP 404" response understood by GoogleBot is to generate the 404 server side. First, write a default...
Read more >State Management In Next.js - Smashing Magazine
Using the server-side methods for generating content statically is often preferable to fetching the state from the client-side. The Context API ...
Read more >Blog - Next.js 13
Next.js 13 introduces layouts, React Server Components, and streaming in the app directory, as well as Turbopack, an improved image ...
Read more >The Next.js Handbook – Learn Next.js for Beginners
It provides a common structure that allows you to easily build a frontend React application, and transparently handles server-side rendering for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This ticket is actually about addressing this. 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 theiraddContextProps()
functions. This ticket is about enablingaddContextProps()
to be called in the browser by defining it in.page.js
instead 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.ts
files 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