meeepsss
meeepsss
TTCTheo's Typesafe Cult
Created by meeepsss on 7/29/2023 in #questions
Verifying query type in `getServerSideProps`
Hello. I have a getServerSideProps function and would like to verify the query to avoid security vulnerabilities and return a 404 page:
interface QueryType {
id: string;
}

export const getServerSideProps = async ({ query }) => {
// check query matches QueryType and return 404 page (return { notFound: true }) otherwise

// ... use id to query from db and return
}
interface QueryType {
id: string;
}

export const getServerSideProps = async ({ query }) => {
// check query matches QueryType and return 404 page (return { notFound: true }) otherwise

// ... use id to query from db and return
}
I've tried validating query with a zod schema, but that doesn't seem to let TS know that query has the type QueryType. How do i verify this in a way which works well for TS?
2 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/29/2023 in #questions
tRPC with ssr: true - what's going on?
I've looked far and wide, and haven't figured this out. ssr: true uses getInitialProps, instead of getServersideProps, which can result in faster page loads since we're not waiting on the server. However, getServersideProps is now the recommended solution. putting ssr: false feels wrong as it seems like this means I won't get ssr. I imagine this is wrong? Is the ssr that trpc is referring to different from the ssr we do want as described in the next js docs?
4 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/26/2023 in #questions
Why do we not use eslint-plugin-prettier in t3 app
Not including this seems like there would be overlap between eslint and prettier. Am I missing something?
15 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/26/2023 in #questions
Do we have an update on t3 stack for the next 13 app directory?
Since afaik the app directory is now stable, are we going to see the t3 stack support it soon? I've looked through github issues but the topic seems to be a little dead. Am I missing something? In the meantime, should be plow on with the pages directory? It seems like trpc, for instance, isn't that well suited to the new app directory approach
2 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/25/2023 in #questions
bloody confused by the new Next.js server actions
Does anyone understand how server actions are pulled from the code I write and actually run on the server? The next build process confuses me and the information I can find is super sparse (https://nextjs.org/learn/foundations/how-nextjs-works/buildtime-and-runtime ...) Any hints for blog posts or similar that dive into what results from the next build and how it does its thing would be awesome
8 replies