mattddean
mattddean
TtRPC
Created by IceAge2OnDVD on 9/8/2023 in #❓-help
Next cookies() not being set on Mutation in App Dir (T3 Turbo)
It seems like unstable_httpBatchStreamLink has this problem, but httpBatchLink does not
19 replies
TtRPC
Created by yxaepnm on 8/13/2023 in #❓-help
Set server response headers from TRPC standalone adapter
This is great, thank you. What's the new Cookie() library you're using? It looks nice
5 replies
TTCTheo's Typesafe Cult
Created by mattddean on 6/27/2023 in #questions
Detect server/client component
I actually think that all that would be required to make this work is if the bundler returned null when importing a server component into a client component. Then we could do ‘return <CloudflareImageServer /> ?? <CloudflareImageClient />’
18 replies
TTCTheo's Typesafe Cult
Created by mattddean on 6/27/2023 in #questions
Detect server/client component
The bundler knows at build time whether Hero is a server or client component. It may be a server component in some places and a client in others. In either case, the bundler infers its type based on where it’s imported
18 replies
TTCTheo's Typesafe Cult
Created by mattddean on 6/27/2023 in #questions
Detect server/client component
Yeah, this is a solution, but it gets less realistic the further into the tree your are. The spirit of the “use client” directive is that we only have to care about the server/client boundary once, not at every component all the way down the tree.
18 replies
TTCTheo's Typesafe Cult
Created by mattddean on 6/27/2023 in #questions
Detect server/client component
The problem is the middleman Hero component. Sometimes it’ll be a server component, and other times it’ll be a client component. It all depends whether it’s rendered in a client or server component. But within the Hero component, I can’t know whether I’m in the server tree or the client tree.
18 replies
TTCTheo's Typesafe Cult
Created by mattddean on 6/27/2023 in #questions
Detect server/client component
The server version uses async/await, then renders the client version. The client version uses a custom loader, passing a function to next/image, so it’s a client component.
18 replies
TTCTheo's Typesafe Cult
Created by mattddean on 6/27/2023 in #questions
Detect server/client component
@whatplan (Rustular Devrel) I agree that it could be a footgun to have a component that behaves differently depending on what imports it, but I don’t see any other way to accomplish this type of functionality. I’m not suggesting any black magic; <CloudflareImage> would be a wrapper that asks react if it’s running as a client or server component, and render either a separate <CloudflareImageClient> or <CloudflareImageServer> component depending. I can write this kind of code right now, but only at the “use client” boundary, not any deeper in the tree. It doesn’t feel at odds with the model to me, as it’s a common pattern to write components that are either client or server components depending on who imports them, like my <Hero> example.
18 replies
TTCTheo's Typesafe Cult
Created by _anno on 6/11/2023 in #questions
What kind of headless CMS would you chose in 2023?
PayloadCMS all the way. It was built by people who got fed up with WordPress, so you’ll find a lot of feature overlap
9 replies