Next 15 (app dir): problem with UI kit: works in Vite, but not Next.js
Answered
Britannia Petite posted this in #help-forum
Britannia PetiteOP
Hey folks,
I started tinkering with latest Next 15, that I want to use with Polaris UI kit. Technically speaking it is not compatibile yet with React 19, but it does work in my Vite project. Suprising, but it doesn't in Next. I assume it might be caused by server components. Could someone point me in the right direction: if this is solvable from my side, or I need to wait for UI kit devs to fix it?
Here's my layout.tsx, and below you will see the error
I started tinkering with latest Next 15, that I want to use with Polaris UI kit. Technically speaking it is not compatibile yet with React 19, but it does work in my Vite project. Suprising, but it doesn't in Next. I assume it might be caused by server components. Could someone point me in the right direction: if this is solvable from my side, or I need to wait for UI kit devs to fix it?
Here's my layout.tsx, and below you will see the error
Answered by averydelusionalperson
You prolly need to take create a wrapper for the AppProvider which is a client component, you mark it as client using
This is what I assume the issue is from the error.
use client
, and use that wrapper inside layout.tsx
.This is what I assume the issue is from the error.
4 Replies
Britannia PetiteOP
You prolly need to take create a wrapper for the AppProvider which is a client component, you mark it as client using
This is what I assume the issue is from the error.
use client
, and use that wrapper inside layout.tsx
.This is what I assume the issue is from the error.
Answer
Someone had same issue as you, so you're not alone: https://community.shopify.com/c/shopify-apps/does-shopify-polaris-support-ssr-server-side-rendering/m-p/2528794
Britannia PetiteOP
Yup, that was it, thank you!