Huperniketes
Huperniketes
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Huperniketes on 6/13/2024 in #questions
How do I map next.config.js code samples in the Next docs to T3's implementation?
Before your answer, I had resorted to defining the headers function outside config's definition:
async function
headers()
{
return [
{
source: "/about",
headers: [
{
key: "x-custom-header",
value: "my custom header value",
},
{
key: "x-another-custom-header",
value: "my other custom header value",
},
],
}
]
}

const config = {
headers: headers,
};
async function
headers()
{
return [
{
source: "/about",
headers: [
{
key: "x-custom-header",
value: "my custom header value",
},
{
key: "x-another-custom-header",
value: "my other custom header value",
},
],
}
]
}

const config = {
headers: headers,
};
But that's pretty kludgy for a single entry in the config declaration.
7 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 6/13/2024 in #questions
How do I map next.config.js code samples in the Next docs to T3's implementation?
That works well, thanks! Especially with the JsDoc type specifier.
7 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 5/13/2024 in #questions
t3 workflow?
Changes in node_modules aren't picked up without modifying the next.conf.js config, which causes the server to be restarted. You can touch the file which causes it to be restarted, but the config must be changed for code in node_modules to be reloaded or the server will just reload whatever was in its cache.
6 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 5/13/2024 in #questions
t3 workflow?
On 3, I had to add an option to the config object in next.conf.js for logging statements to work:
const config = {
compiler: {
removeConsole: false,
},
}
const config = {
compiler: {
removeConsole: false,
},
}
6 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 5/13/2024 in #questions
t3 workflow?
Thanks for your reply. You've confirmed my understanding of how it should work, so I'll continue digging into the anomalies I see.
6 replies
TtRPC
Created by Huperniketes on 7/8/2023 in #❓-help
Are GET and POST the only HTTP verbs supported?
.
3 replies
TtRPC
Created by Grifn on 7/10/2023 in #❓-help
tRPC + App directory + SSR - current state?
As written in the tRPC home page,
tRPC allows you to easily build & consume fully typesafe APIs without schemas or code generation.
tRPC allows you to easily build & consume fully typesafe APIs without schemas or code generation.
It only manages the creation and use of a web app’s APIs. So it sounds like it should work okay, as the biggest difference between the pages- and the app-routers rendering is where the server's page rendering code is situated, and not where the API code is. For SSR in the app-router, it's in the server component where you would use tRPC’s router.createCaller() interface for the APIs. In the pages-router, this code would be in getServerSideProps().
11 replies
TTCTheo's Typesafe Cult
Created by variable_name on 7/5/2023 in #questions
Clerk: Is it possible to create custom metadata on signup using Clerk?
4 replies
TTCTheo's Typesafe Cult
Created by variable_name on 7/5/2023 in #questions
Clerk: Is it possible to create custom metadata on signup using Clerk?
You can create a webhook API for Clerk to notify you when a user's been created.
4 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 7/5/2023 in #questions
how can I invoke a trpc call inside a nested function?
Thank you very much!
14 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 7/5/2023 in #questions
how can I invoke a trpc call inside a nested function?
Yeah, that did the trick. I just needed to do a little more data massaging of my stuff for everything to work.
14 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 7/5/2023 in #questions
how can I invoke a trpc call inside a nested function?
And react doesn't regard it as a hook?
14 replies
TTCTheo's Typesafe Cult
Created by Huperniketes on 7/5/2023 in #questions
how can I invoke a trpc call inside a nested function?
Don't they normally do that? eg, api.posts.getAll.useQuery() in theo's t3 tutorial?
14 replies
TTCTheo's Typesafe Cult
Created by four4255 on 6/29/2023 in #questions
NextJS app router trips/[id]/page.tsx
If you need to set up props with getServerSideProps(), you'd do something like
export async function
getServerSideProps(ctx: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>): Promise<{ props: {
id: string,
}}>
{
const id = ctx.query?.id || "";

return ({ props: { id }});
}
export async function
getServerSideProps(ctx: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>): Promise<{ props: {
id: string,
}}>
{
const id = ctx.query?.id || "";

return ({ props: { id }});
}
4 replies
TTCTheo's Typesafe Cult
Created by z on 6/26/2023 in #questions
NextJS "Module not found" error with "loading.tsx"?
I found the source for the error I experienced: I imported the needed definition from the wrong file. When I used the correct file reference, the error went away and the build completed.
13 replies
TTCTheo's Typesafe Cult
Created by z on 6/26/2023 in #questions
NextJS "Module not found" error with "loading.tsx"?
That isn't the actual error, and I don't recall what the cause was when I got this error. What was the last change you made?
13 replies
TTCTheo's Typesafe Cult
Created by import_antigravity on 6/27/2023 in #questions
tanstack query (requests in bulk vs individual)
Wouldn't prefetchQuery() be more like what you're looking for?
10 replies