Panziewanz
Panziewanz
TTCTheo's Typesafe Cult
Created by Panziewanz on 10/18/2023 in #questions
No session provider wrapping children in layout.tsx
I noticed that the session provider is no longer wrapping the children in layout.tsx when generating a new app using Next auth and the app dir. Was this intended or was it just left out on accident?
3 replies
TTCTheo's Typesafe Cult
Created by Panziewanz on 10/16/2023 in #questions
Server page being recognized as a Client component
I have a server component src/app/blog/[slug]/page.tsx that is being recognized as a client component and I'm not seeing why. It IS rendering a client component <CommentLayout /> but, as I understand, that shouldn't matter. I'm getting an error fetching data from the file system and generating MetaData for the route. Am I going about this in the wrong manner?
Here's the error I'm getting which states to not export the generateMetadata function but the docs clearly state this is fine.
File path:
./src/app/blog/[slug]/page.tsx
./src/app/blog/[slug]/page.tsx
ReactServerComponentsError:

You are attempting to export "generateMetadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://nextjs.org/docs/getting-started/react-essentials#the-use-client-directive

╭─[/Users/Panzermensch/Desktop/Projects/next-blog/src/app/blog/[slug]/page.tsx:48:1]
48 │ };
49 │ }
50
51 │ export async function generateMetadata({
· ────────────────
52 │ params,
53 │ }: {
54 │ params: { slug: string };
╰────
File path:
./src/app/blog/[slug]/page.tsx
./src/app/blog/[slug]/page.tsx
ReactServerComponentsError:

You are attempting to export "generateMetadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://nextjs.org/docs/getting-started/react-essentials#the-use-client-directive

╭─[/Users/Panzermensch/Desktop/Projects/next-blog/src/app/blog/[slug]/page.tsx:48:1]
48 │ };
49 │ }
50
51 │ export async function generateMetadata({
· ────────────────
52 │ params,
53 │ }: {
54 │ params: { slug: string };
╰────
19 replies
TTCTheo's Typesafe Cult
Created by Panziewanz on 8/30/2023 in #questions
Looking for code review on trpc method calls
As stated I'm looking for some code review on a blog that I've been working on using the T3 stack. I'm relatively new to web dev and am working on the app for personal use and have it working but I also know that I have made some programming fauxpas and more or less looking for "you are on the right track here" or "yeah... stop what you're doing here and refactor, try..." I don't know exactly if this is the correct channel to ask this sort of thing in.
Full repo here: https://github.com/L-Steinmacher/next-blog I know that the logic on this component needs some love badly with the trpc calls:https://github.com/L-Steinmacher/next-blog/blob/25c33410f19b4e0be4b6fb58122949b0d5c3026f/src/components/commentLayout.tsx#L52
2 replies