Comments (3)
If that's the only component that's causing it, you can change that part to use either SWR or useEffect like this:
SWR
const supabase = createClientComponentClient()
const getUser = async () => {
const { data: { user } } = await supabase.auth.getUser()
return user
}
const { data: user } = useSWRImmutable('getUser', getUser)
useEffect
const [user, setUser] = useState<User>()
useEffect(() => {
const supabase = createClientComponentClient()
async function getUser() {
const { data: { user } } = await supabase.auth.getUser()
return user
}
getUser().then((user) => setUser(user))
}, [])
Make sure you 'use client' at top of page and import the necessary modules.
from nextjs-subscription-payments.
Thank you for your prompt reply. I was wondering if there is a way to retain the supabase request for user information on the server, while also being able to statically generate or cache the rest of the page. I believed that Next.js 13 made this possible. Can I keep the navbar as it is, but use generateStaticParams for multiple static pages to be pre-built beforehand?
from nextjs-subscription-payments.
Thank you for your prompt reply. I was wondering if there is a way to retain the supabase request for user information on the server, while also being able to statically generate or cache the rest of the page. I believed that Next.js 13 made this possible. Can I keep the navbar as it is, but use generateStaticParams for multiple static pages to be pre-built beforehand?
At the top of each page or component, you can add 'use client' or 'use server' as desired. Typically you want server components to be above client components in the tree, but technically I believe you can chain them however you want.
But for static content, why wouldn't you want them to be rendered server-side? Rendering static content is, like, one of the main use cases for SSR.
from nextjs-subscription-payments.
Related Issues (20)
- Stripe link redirects to the wrong URL when returning from the "customer Portal" HOT 1
- Feature Request: Light Mode , Dark Mode HOT 1
- Is using SUPABASE_SERVICE_ROLE_KEY in the app safe? HOT 1
- Issue with trial period setting HOT 1
- Webhook Error: No signatures found matching the expected signature for payload. HOT 3
- Is there a fork of this repo that uses popular ORMs like prisma or drizzle ? HOT 2
- Supabase + Vercel Deploy Button loading forever HOT 3
- No overload matches this call. ./app/account/page.tsx:47 HOT 11
- Getting ECONNREFUSED when starting `npm run dev` HOT 1
- Breaking Change by Stripe: Example needs overhaul HOT 1
- Defining the "Main Deployment URL" HOT 2
- Type error `priceData` HOT 3
- Stuck after setting up Supabase when using "Deploy Now" HOT 4
- Feature Request: Documentation
- Cannot setup supabase local instance HOT 2
- Can't import shadcn button component HOT 2
- Vercel Deploy Button setup process broken HOT 1
- updateName doesn't update the name in account page HOT 15
- --turbo flag breaks dependencies HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextjs-subscription-payments.