-
Notifications
You must be signed in to change notification settings - Fork 1
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
Consider renaming "Server Context" in this repo + blog post #1
Comments
Hey @karlhorky, thanks for the valuable feedback. At the moment this Twitter thread (which helped me a lot to write this article) doesn't really define My reasoning here for the "context" part is that in Next.js 12, you had a The "Next.js Cache" wording has been introduced slightly after we've published this article, which I started preparing quickly after the official release of 13.0. It might be a good naming, it's probably the same concept as the server context I mention, however it's also not documented enough so I can't fully confirm. Possible alternatives could be "request context", "request cache", "server cache", but they feel more ambiguous, in particular this cache can also be used during static rendering so without request (or more precisely with a fictious request but that's not how people understand it). By the way there will probably be a follow-up article describing Next.js implementation of server-side caching with AsyncLocalStorage when Next.js code is more stable, I've started exploring it and it's extremely interesting, it could also be a good occasion to iterate on the naming if needed. cc @gracemiller23 who is the naming expert here :) |
I think this is where our understandings of It seems to me that the word "context" is a loaded word in the React ecosystem, since it most commonly refers to React Context - passing information down through multiple component layers without too much ceremony. This also is closer to React ServerContext - if my understanding is correct - although The second type of context (like This second type of context is not referred to often anymore in the beta docs, which probably lends itself at least partly to the new design of Server Components and Route Handlers (the successors to API Routes), which do not receive all of this same information. However, the dynamic route parameters are still contained within an object called I wouldn't be too surprised to see these examples of the second type of context get renamed over the next versions of Next.js too, to disambiguate and move away from the loaded word "context". Based on this and my current understanding, the generic name "server cache" feels like the closest to what the article is describing, unless you find out that Next.js Cache is indeed describing the same thing, in which case this would be the better name. |
Thanks those are great insights, I think what I'll do is that I'll wait a bit that things get figured more precisely in Next, and if the wording ends up being indeed confusing we may add a banner in the article/this repo and explain the evolution of Next.js more precisely in a second article. I do not make a difference between the two types of context you mention, as to me the server context is both:
What bothers me with "cache" is that it doesn't have this notion of scope, in the first place I didn't figure that React 18 The wording has indeed disappeared from Next.js doc so that's why I really take your feedback into consideration, right now I am trying to fill a gap but I know that big changes are expected and will come with more precisions. I'll try to follow the news. If a new kind of context that can cross boundaries is released, that would be awesome. However I hope it will be called something more explicit like "CrossContext" or "IsoContext" or whatever. Exciting times ahead either way :) |
Oh I forgot this is actually included in the tweet from Sebastian that I posted in the original issue description at the top of this page:
Another example can be seen in the test here. In the Next.js codebase, the So with Next.js and also React, there are a few signals which seem to show that "Server Context" will refer to |
Hi @eric-burel, thanks so much for your Leveraging Server Context for Advanced Next.js Optimization Patterns blog post and this accompanying repo, really cool! 🙌
I was thinking that you may want to consider renaming all occurrences of "Server Context" across this repo and also in your blog post, because
ServerContext
appears to be something different, where you should not store very much information:I haven't seen the information stored in
cache()
andfetch()
and similar be referred to as "Server Cache". The closest thing that I've seen is officially called "Next.js Cache", referred to here:cc @sebmarkbage @timneutkens
By the way, this is just what my read on the terminology / naming is with these topics - I could also be wrong! Happy to learn here.
The text was updated successfully, but these errors were encountered: