How can I use my own theme provider? #86
Replies: 2 comments 5 replies
-
Hey @AFK-Python! I've not tried using Fluent UI before. You're likely getting a flash of unstyled content (FOUC) using The editor ( To test this, try disabling JavaScript in your browser. won't render anything. will be unstyled. This sounds more like a Fluent UI + Next.js 13 (with App Router) issue than anything to do with Puck specifically - probably something with how the styles are injected on the server. I'd recommend looking into that specifically. If you're stuck, take Puck out of the mix entirely and see if you can get it working. Alternatively, you could try using the Next.js Pages Router instead of the App Router. Hope that helps! Going to move this to Discussions. |
Beta Was this translation helpful? Give feedback.
-
I was able to achieve the behavior I wanted by just removing the pre-rendering/server side rendering. I get this kinda defeats the purpose of Next, but it works well for my team's use case. I made the following change to the client.tsx file:
and I updated the corresponding import:
|
Beta Was this translation helpful? Give feedback.
-
I've been trying to use the provider from Fluent UI - see here for docs - but I can't quite seem to get it to work properly.
I've currently wrapped the
Render
component in theclient.tsx
file like so:This does allow me to style children components in the
puck.config.tsx
file with theteamsTheme
; however, pages on the client side seem to render as vanilla html briefly (it ends up being pretty apparent on a reload), before re-rendering with theteamsTheme
.I tried wrapping the
Client
component in[...puckpath]/pages.tsx
with the MS Teams provider, but this led to some errors that I wasn't sure how to go about fixing:Is there a way I can avoid this re-render and have my components from the config display immediately with the theme I would like them to?
Interestingly enough, this re-render doesn't appear on the edit page - the components immediately appear as MS Teams styled there.
Apologies for the niche question, but I am not super familiar with Next and I'm having a little difficulty navigating how I would edit the starter repo code to accomplish this.
Thanks in advance,
Alex
Beta Was this translation helpful? Give feedback.
All reactions