#Cannot access session/user data from staticly generate pages in nextjs 13
20 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
there is no workaround. if you need dynamic data its not a static page.
Ohk thanks, can help me understand this
I want to understand it for the same question I had before.
As above mentioned, it's impossible to keep it fully static.
Basically, in your use case, your app can't be fully static due to personalized data.
Then, how to keep it fast while it is a dynamic route (rendered at request time)? Cache, You can cache the product data.
Hence, you won't have to re-fetch the data every time the user enters your site.
I am new to app router but I understood caching is the way to keep it fast, but I don't particularly know how to cache only the product data,
is it related to this
no, go to the cache section. Next.js only caches fetch by default.
I am using Supabase's js lib which I don't think can handle cache the way fetch handles. So if you read image below, it says it is related to route segment config.
The thing I am looking for is performant nextjs page with static like speed.
And imo, export const dynamic="auto" should perform better than other as well as giving access to dynamic functions. Please correct me if I am wrong.
No, auto is just the default behaviour. By default, your page is cached and statically generated. You can try testing it locally.
For now, you can’t cache third party libraries. unstable_cache is not yet stable
Which option from these can give me best caching for now?
Yea, 🥲 I read it there. Eagerly waiting for it.
Only dynamic, you can’t cache it since you are reading cookies (as you mentioned)
These are dynamic functions
I want to ask one more question, Can I make an API endpoint and send the cart data to the db that way?
Not encouraged because that can cause error during pre-rendering
When Next.js builds your app, route handlers won’t be available
This question has been marked as answered! If you have any other questions, feel free to create another post
[Click here](#1152688771289071626 message)